├── .github └── workflows │ ├── CI.yml │ ├── appimage.yml │ ├── emscripten.yml │ └── windows.yml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile ├── Makefile.mingw ├── PKGBUILD.in ├── README.md ├── Rules.make.macosx ├── Rules.make.standalone ├── Rules.make.system ├── Rules.mingw ├── cmake ├── FindGLIB.cmake ├── FindGTK3.cmake ├── FindHarfBuzz.cmake ├── FindIconv.cmake ├── FindLuaJIT.cmake ├── FindSDL2.cmake ├── FindSDL2_image.cmake ├── FindSDL2_mixer.cmake ├── FindSDL2_ttf.cmake ├── InstallSymlink.cmake └── iconv_test.c ├── configure-mingw32.sh ├── configure.sh ├── contrib ├── appimage.tar.gz ├── instead-em-build.sh ├── instead-em.zip ├── instead-sailfish-game.spec ├── instead-sailfish.spec ├── instead.spec ├── setup.iss ├── webinst.lua └── winrt.patch ├── debian ├── changelog ├── compat ├── control ├── copyright └── rules ├── desktop ├── CMakeLists.txt ├── Makefile └── instead.desktop.in ├── doc ├── CMakeLists.txt ├── Makefile ├── embedding-ru.md ├── examples │ ├── stead2 │ │ ├── cutscene.lua │ │ ├── dialog │ │ │ └── main.lua │ │ ├── fonts.lua │ │ ├── keyboard │ │ │ ├── keyboard.lua │ │ │ └── main.lua │ │ ├── menu-demo │ │ │ └── main.lua │ │ └── trigger.lua │ └── stead3 │ │ └── dialog │ │ └── main3.lua ├── instead.6 ├── modules3-ru.md ├── modules3-ru.tex ├── stead3-en.md ├── stead3-en.tex ├── stead3-ru.md └── stead3-ru.tex ├── games ├── CMakeLists.txt ├── Makefile └── tutorial │ ├── br.png │ ├── de.png │ ├── es.png │ ├── fr.png │ ├── gb.png │ ├── instead.ogg │ ├── instead.png │ ├── it.png │ ├── main-de.lua │ ├── main-en.lua │ ├── main-es.lua │ ├── main-fr.lua │ ├── main-it.lua │ ├── main-nl.lua │ ├── main-pt.lua │ ├── main-ru.lua │ ├── main-uk.lua │ ├── main3.lua │ ├── nl.png │ ├── ru.png │ ├── tutorial.lua │ └── uk.png ├── icon ├── CMakeLists.txt ├── Makefile ├── book16x16.ico ├── instead-s60.svg ├── sdl_instead.ico ├── sdl_instead.png ├── sdl_instead.svg ├── sdl_instead_1.png └── sdl_instead_1x32.png ├── lang ├── CMakeLists.txt ├── Makefile ├── cs.ini ├── de.ini ├── en.ini ├── es.ini ├── fr.ini ├── it.ini ├── nl.ini ├── pt.ini ├── ru.ini └── uk.ini ├── sdl-instead ├── src ├── CMakeLists.txt ├── Makefile ├── SDL_gfxBlitFunc.c ├── SDL_gfxBlitFunc.h ├── SDL_gif.c ├── SDL_gif.h ├── SDL_rotozoom.c ├── SDL_rotozoom.h ├── android.h ├── config.c ├── config.h ├── externals.h ├── game.c ├── game.h ├── graphics.c ├── graphics.h ├── input.c ├── input.h ├── instead │ ├── cache.c │ ├── cache.h │ ├── idf.c │ ├── idf.h │ ├── instead.c │ ├── instead.h │ ├── lfs.c │ ├── list.c │ ├── list.h │ ├── snprintf.c │ ├── snprintf.h │ ├── system.h │ ├── tinymt32.c │ ├── tinymt32.h │ ├── util.c │ └── util.h ├── instead_bits.c ├── instead_paths.c ├── instead_sound.c ├── instead_sprites.c ├── instead_timer.c ├── internals.h ├── ioapi.c ├── ioapi.h ├── ios.h ├── ios.m ├── iowin32.c ├── iowin32.h ├── macosx.m ├── main.c ├── menu.c ├── menu.h ├── noise1234.c ├── noise1234.h ├── resources.rc ├── sound.c ├── sound.h ├── themes.c ├── themes.h ├── tiny │ ├── Makefile │ ├── ifbot │ │ ├── discord-bot │ │ │ └── main.go │ │ ├── ifbot │ │ │ └── server.go │ │ ├── tg-bot │ │ │ └── main.go │ │ ├── tty │ │ │ └── main.go │ │ └── vk-bot │ │ │ └── main.go │ ├── instead.lua │ ├── main.c │ ├── metaparser.c │ ├── tiny.lua │ ├── tiny2.lua │ └── tiny3.lua ├── unix.c ├── unpack.c ├── unzip.c ├── unzip.h ├── utils.c ├── utils.h ├── windows.c ├── winrt.c └── zlib │ ├── Makefile │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── example.c │ ├── gzio.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── minigzip.c │ ├── readme │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zconf.in.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h ├── stead ├── CMakeLists.txt ├── Makefile ├── stead2 │ ├── CMakeLists.txt │ ├── click.lua │ ├── counters.lua │ ├── dash.lua │ ├── dbg.lua │ ├── dlg.lua │ ├── events.lua │ ├── ext │ │ ├── gui.lua │ │ ├── paths.lua │ │ ├── sound.lua │ │ ├── sprites.lua │ │ └── timer.lua │ ├── finger.lua │ ├── format.lua │ ├── hideinv.lua │ ├── hotkeys.lua │ ├── input.lua │ ├── kbd.lua │ ├── nolife.lua │ ├── nouse.lua │ ├── object.lua │ ├── para.lua │ ├── pixels.lua │ ├── prefs.lua │ ├── proxymenu.lua │ ├── quotes.lua │ ├── snapshots.lua │ ├── sound.lua │ ├── sprites.lua │ ├── stead.lua │ ├── theme.lua │ ├── timer.lua │ ├── vars.lua │ ├── walk.lua │ ├── wroom.lua │ └── xact.lua └── stead3 │ ├── .luacheckrc │ ├── CMakeLists.txt │ ├── click.lua │ ├── dbg-ru.lua │ ├── dbg.lua │ ├── declare.lua │ ├── dlg.lua │ ├── events.lua │ ├── ext │ ├── gui.lua │ ├── paths.lua │ ├── sandbox.lua │ ├── sound.lua │ ├── sprites.lua │ └── timer.lua │ ├── finger.lua │ ├── fmt.lua │ ├── keys.lua │ ├── noinv.lua │ ├── nolife.lua │ ├── prefs.lua │ ├── snapshots.lua │ ├── snd.lua │ ├── sprite.lua │ ├── stdlib.lua │ ├── stead.lua │ ├── theme.lua │ └── timer.lua └── themes ├── CMakeLists.txt ├── Makefile ├── arctic ├── adown.png ├── aup.png ├── bg.png ├── cursor-use.png ├── cursor.png ├── menu.png └── theme.ini ├── bluesteel ├── bg.png ├── cursor-use.png ├── cursor.png ├── downarrow.png ├── menu.png ├── theme.ini └── uparrow.png ├── book ├── book.png └── theme.ini ├── clearlooks ├── adown.png ├── aup.png ├── bg.jpg ├── cursor-use.png ├── cursor.png ├── menu.png └── theme.ini ├── default ├── adown.png ├── aup.png ├── bg.png ├── click.ogg ├── click.wav ├── cursor-use.png ├── cursor.png ├── menu.png ├── sans-b.ttf ├── sans-bi.ttf ├── sans-i.ttf ├── sans.ttf ├── theme.ini └── use.png ├── fantasy ├── bg.png ├── down.png ├── menu.png ├── theme.ini └── up.png ├── mobile ├── bg.png └── theme.ini └── wide ├── bg.png └── theme.ini /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | workflow_dispatch: 7 | pull_request: 8 | 9 | jobs: 10 | build: 11 | name: ${{ matrix.config.name }} 12 | runs-on: ${{ matrix.config.os }} 13 | strategy: 14 | fail-fast: true 15 | matrix: 16 | config: 17 | - { 18 | name: "with lua5.1", 19 | os: "ubuntu-latest", 20 | packages: "liblua5.1-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev", 21 | cmake_opts: "-DSTANDALONE=1 -DWITH_LUAJIT=0 -DWITH_GTK3=FALSE" 22 | } 23 | - { 24 | name: "with luajit and gtk3", 25 | os: "ubuntu-latest", 26 | packages: "libluajit-5.1-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libgtk-3-dev", 27 | cmake_opts: "-DSTANDALONE=1 -DWITH_LUAJIT=1 -DWITH_GTK3=TRUE" 28 | } 29 | 30 | steps: 31 | - uses: actions/checkout@main 32 | 33 | - name: Create Build Directory 34 | run: cmake -E make_directory ${{github.workspace}}/build 35 | 36 | - name: Install Packages 37 | run: | 38 | sudo apt-get update -qq 39 | sudo apt-get install -y ${{ matrix.config.packages }} 40 | sudo apt-get install -y build-essential 41 | 42 | - name: Configure CMake 43 | run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release ${{ matrix.config.cmake_opts }} 44 | 45 | - name: Build 46 | run: cmake --build ./build --config Release 47 | 48 | # - name: Create Artifact 49 | # run: | 50 | # cmake --install ./build 51 | 52 | # - name: Publish Artifact 53 | # uses: actions/upload-artifact@v4 54 | # with: 55 | # name: standalone 56 | # path: build/standalone 57 | -------------------------------------------------------------------------------- /.github/workflows/appimage.yml: -------------------------------------------------------------------------------- 1 | name: AppImage 2 | on: 3 | push: 4 | branches: [master] 5 | workflow_dispatch: 6 | 7 | jobs: 8 | build: 9 | name: build AppImage 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@main 13 | 14 | - name: Create Build Directory 15 | run: cmake -E make_directory ${{github.workspace}}/build 16 | 17 | - name: Install Packages 18 | 19 | run: | 20 | sudo apt-get update -qq 21 | sudo apt-get install -y wget libluajit-5.1-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libgtk-3-dev 22 | 23 | - name: Configure CMake 24 | run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DWITH_LUAJIT=1 -DAPPIMAGE=1 -DWITH_GTK3=1 25 | 26 | - name: Build 27 | run: cmake --build ./build --config Release 28 | 29 | - name: Create Artifact 30 | run: | 31 | sudo apt-get install -y libfuse2 32 | DESTDIR=appimage cmake --install ./build 33 | tar -xvf contrib/appimage.tar.gz --strip-components=1 -C appimage 34 | wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage 35 | chmod +x linuxdeploy-x86_64.AppImage 36 | ./linuxdeploy-x86_64.AppImage --appdir appimage 37 | wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage 38 | chmod +x ./appimagetool-x86_64.AppImage 39 | ./appimagetool-x86_64.AppImage appimage/ 40 | 41 | - name: Publish Artifact 42 | uses: actions/upload-artifact@v4 43 | with: 44 | name: AppImage 45 | path: INSTEAD-x86_64.AppImage 46 | -------------------------------------------------------------------------------- /.github/workflows/emscripten.yml: -------------------------------------------------------------------------------- 1 | name: Emscripten version 2 | on: 3 | push: 4 | branches: [master] 5 | workflow_dispatch: 6 | 7 | env: 8 | emsdk_ver: 3.1.49 9 | 10 | jobs: 11 | build: 12 | name: Emscripten version 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@main 16 | 17 | - name: Cache emsdk 18 | id: cache-emsdk 19 | uses: actions/cache@v4 20 | with: 21 | path: emsdk 22 | key: ${{ runner.os }}-${{ env.emsdk_ver }} 23 | 24 | - name: Install Packages 25 | run: | 26 | sudo apt-get update -qq 27 | sudo apt-get install -y git 28 | 29 | - if: ${{ steps.cache-emsdk.outputs.cache-hit != 'true' }} 30 | name: Prep 31 | run: | 32 | git clone https://github.com/emscripten-core/emsdk.git 33 | cd emsdk 34 | ./emsdk install ${{ env.emsdk_ver }} 35 | ./emsdk activate ${{ env.emsdk_ver }} 36 | mkdir env 37 | 38 | - name: Build 39 | run: | 40 | cd emsdk 41 | export WORKSPACE="${{github.workspace}}/emsdk/env" 42 | ../contrib/instead-em-build.sh 43 | 44 | - name: Create Artifact 45 | run: | 46 | cd emsdk 47 | mkdir -p ../release/instead-em 48 | cp env/instead-em-js/instead-em.* ../release/instead-em 49 | cp -f env/instead-em-js/instead.html ../release/instead-em/instead-em.html 50 | cp env/instead-em-js/load* ../release/instead-em 51 | cp env/instead-em-js/*.svg ../release/instead-em 52 | 53 | - name: Publish Artifact 54 | uses: actions/upload-artifact@v4 55 | with: 56 | name: instead-em 57 | path: release 58 | retention-days: 1 59 | -------------------------------------------------------------------------------- /.github/workflows/windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows version 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | name: Windows version 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@main 14 | 15 | - name: Install Packages 16 | run: | 17 | sudo apt-get update -qq 18 | sudo apt-get install -y gcc-mingw-w64-i686 mingw-w64-i686-dev binutils-mingw-w64-i686 19 | sudo apt-get install -y build-essential 20 | 21 | - name: Prep 22 | run: make windows-sdl2.tar.gz 23 | 24 | - name: Configure 25 | run: ./configure-mingw32.sh 26 | 27 | - name: Build 28 | run: make -f Makefile.mingw 29 | 30 | - name: Create Artifact 31 | run: make install -f Makefile.mingw 32 | 33 | - name: Publish Artifact 34 | uses: actions/upload-artifact@v4 35 | with: 36 | name: instead-win 37 | path: bin 38 | retention-days: 1 39 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | INSTEAD was written by: 2 | Peter Kosyh 3 | 4 | Initial port to Windows: 5 | Ilya Ryndin 6 | 7 | Port to Android: 8 | Mahno Aleksey 9 | Anton Kolosov 10 | Boris Timofeev 11 | 12 | Port to macOS: 13 | .dm 14 | 15 | Port to Windows CE: 16 | Andrey Afletdinov 17 | 18 | Debian package: 19 | Sam Protsenko 20 | 21 | FreeBSD port, cmake support and fixes: 22 | Dmitry Marakasov 23 | 24 | Right-to-Left and multilingual mixed text support: 25 | Mehdi Sadeghi 26 | 27 | Ideas, games, advices, testing, bug reports, fixes ... 28 | Vadim Balashoff 29 | Evgeniy Efremov (jhekasoft) 30 | Oleg Gvozdev 31 | Heorhiy Kharvat (zaynyatyi) 32 | Serj Kalichev 33 | Vladimir Podobaev 34 | Alexander Soborov 35 | Vasily Voronkov 36 | Alexander Yakovlev 37 | Vladimir Zhirov 38 | Andrew Lobanov 39 | And many, many others... 40 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) 2 | PROJECT(instead) 3 | 4 | SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) 5 | 6 | IF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") 7 | MESSAGE(FATAL_ERROR "In-source builds are not allowed. Please read ./INSTALL") 8 | ENDIF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") 9 | 10 | # global constants 11 | SET(INSTEAD_VERSION "3.5.2") 12 | 13 | # options 14 | OPTION(WITH_GTK2 "Use GTK2 file open dialog" OFF) 15 | OPTION(WITH_GTK3 "Use GTK3 file open dialog" ON) 16 | OPTION(WITH_ICONV "Build with iconv support" ON) 17 | OPTION(WITH_LUAJIT "Use LuaJIT instead of Lua" ON) 18 | OPTION(WITH_HARFBUZZ "Build with HarfBuzz for RTL language support" OFF) 19 | 20 | # Note: there are three build modes for instead: 21 | # - SYSTEMWIDE 22 | # use it if you want to install it into your (unix) system 23 | # - STANDALONE 24 | # used to generate standalone relocatable package which 25 | # may be run from anywhere. `install' target stages all 26 | # required files in ${STANDALONEDIR} for you 27 | # - neither (both options disabled) 28 | # instead may be run from build directory, useful for 29 | # development 30 | OPTION(SYSTEMWIDE "Build for systemwide install" ON) 31 | OPTION(STANDALONE "Build for standalone package creation" OFF) 32 | OPTION(APPIMAGE "Build for appimage package creation" OFF) 33 | 34 | IF(WITH_GTK2 AND WITH_GTK3) 35 | MESSAGE(WARNING "WITH_GTK2 and WITH_GTK3 are mutually exclusive, disabling WITH_GTK2") 36 | SET(WITH_GTK2 OFF) 37 | ENDIF(WITH_GTK2 AND WITH_GTK3) 38 | 39 | IF(SYSTEMWIDE AND STANDALONE) 40 | MESSAGE(WARNING "Both STANDALONE and SYSTEMWIDE specified, disabling SYSTEMWIDE") 41 | SET(SYSTEMWIDE OFF) 42 | ENDIF(SYSTEMWIDE AND STANDALONE) 43 | 44 | IF(APPIMAGE) 45 | SET(CMAKE_INSTALL_PREFIX "/usr") 46 | ENDIF(APPIMAGE) 47 | 48 | SET(BINDIR "bin" CACHE STRING "Where to install binaries") 49 | SET(DATADIR "share/instead" CACHE STRING "Where to install data files") 50 | SET(STEADDIR "${DATADIR}/stead" CACHE STRING "Where to install stead files") 51 | SET(THEMESDIR "${DATADIR}/themes" CACHE STRING "Where to install themes") 52 | SET(GAMESDIR "${DATADIR}/games" CACHE STRING "Where to install games") 53 | SET(ICONDIR "share/pixmaps" CACHE STRING "Where to install icons") 54 | SET(DOCDIR "share/doc/instead" CACHE STRING "Where to install documentation") 55 | SET(LANGDIR "${DATADIR}/lang" CACHE STRING "Where to install language files") 56 | SET(MANDIR "share/man" CACHE STRING "Where to install man pages") 57 | SET(DESKTOPDIR "share/applications" CACHE STRING "Where to install .desktop files") 58 | 59 | SET(STANDALONEDIR "${PROJECT_BINARY_DIR}/standalone" CACHE STRING "Where to stage stanalone package") 60 | 61 | # subdirectories 62 | ADD_SUBDIRECTORY(desktop) 63 | ADD_SUBDIRECTORY(doc) 64 | ADD_SUBDIRECTORY(games) 65 | ADD_SUBDIRECTORY(icon) 66 | ADD_SUBDIRECTORY(lang) 67 | ADD_SUBDIRECTORY(src) 68 | ADD_SUBDIRECTORY(stead) 69 | ADD_SUBDIRECTORY(themes) 70 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright 2009-2023 Peter Kosyh 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation files 5 | (the "Software"), to deal in the Software without restriction, 6 | including without limitation the rights to use, copy, modify, merge, 7 | publish, distribute, sublicense, and/or sell copies of the Software, 8 | and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | Please see each individual source file for a list of they copyright holders. 23 | 24 | INSTEAD links with the following libraries/sources: 25 | 26 | Lua (MIT) 27 | SDL_gif.c (Zlib) 28 | SDL2 (Zlib) 29 | SDL2_image (Zlib) 30 | SDL2_ttf (Zlib) 31 | SDL2_mixer (Zlib) 32 | SDL2_gfx (Zlib) 33 | 34 | Freetype (LGPL) 35 | FFmpeg (LGPL) 36 | jpeg (JPEG License) 37 | libpng (PNG license) 38 | zlib (Zlib License) 39 | list routines (MIT) (http://ccodearchive.net/info/list.html) 40 | LuaFileSystem (http://keplerproject.github.io/luafilesystem/license.html) 41 | tinymt32 (The 3-clause BSD License) 42 | 43 | HarfBuzz (old MIT) 44 | GLib (LGPL) 45 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include Rules.make 2 | include config.make 3 | 4 | VERTITLE := instead-$(VERSION) 5 | ARCHIVE := instead_$(VERSION).tar.gz# 6 | 7 | SUBDIRS += src/ stead games themes icon desktop doc lang 8 | 9 | all: 10 | @for dir in $(SUBDIRS); do \ 11 | $(MAKE) -C $$dir $(@) || exit 1; \ 12 | done; 13 | 14 | Rules.make: 15 | ln -sf Rules.make.standalone Rules.make 16 | 17 | config.make: 18 | echo "# you can define own flags here" > config.make 19 | 20 | svnclean: 21 | { test -d .svn && svn st; } | grep "^?" | awk '{ print $$2 }' | grep -v "config.make" | while read l; do $(RM) -rf $$l; done 22 | 23 | gitclean: 24 | { test -d .git && git status -s; } | grep "^??" | awk '{ print $$2 }' | grep -v "config.make" | while read l; do $(RM) -rf $$l; done 25 | 26 | rules: 27 | $(RM) -f Rules.make 28 | ln -sf Rules.make.standalone Rules.make 29 | 30 | docs: rules 31 | make docs -C doc/ 32 | 33 | PKGBUILD: PKGBUILD.in tarball 34 | cat PKGBUILD.in | sed -e s/MD5SUM/`md5sum $(ARCHIVE) | cut -f1 -d' '`/g > PKGBUILD 35 | 36 | windows-sdl2.tar.gz: 37 | wget "http://sourceforge.net/projects/instead/files/instead/build-bin-data/windows-sdl2-2.0.24.2.tar.gz/download" -O $(@) 38 | # wget "http://sourceforge.net/projects/instead/files/instead/build-bin-data/windows-sdl2-2.0.24.tar.gz/download" -O $(@) 39 | # wget "http://sourceforge.net/projects/instead/files/instead/build-bin-data/windows-sdl2-2.0.22.tar.gz/download" -O $(@) 40 | # wget "http://sourceforge.net/projects/instead/files/instead/build-bin-data/windows-sdl2-2.0.14.tar.gz/download" -O $(@) 41 | 42 | build-bin-data: windows-sdl2.tar.gz 43 | 44 | tarball: clean svnclean gitclean docs rules 45 | echo "# you can define own flags here" > config.make 46 | ln -sf ./ $(VERTITLE) 47 | tar -cz --exclude $(VERTITLE)/$(VERTITLE) --exclude CJK.zip --exclude .git --exclude .svn --exclude $(ARCHIVE) --exclude windows-sdl2.tar.gz -f $(ARCHIVE) $(VERTITLE)/* 48 | $(RM) -f $(VERTITLE) 49 | 50 | clean: 51 | @for dir in $(SUBDIRS); do \ 52 | $(MAKE) clean -C $$dir $(@) || exit 1; \ 53 | done; 54 | $(RM) -f $(ARCHIVE) 55 | $(RM) -f PKGBUILD 56 | 57 | install: all 58 | ifeq ($(SYSTEMSETUP), yes) 59 | @for dir in $(SUBDIRS); do \ 60 | $(MAKE) -C $$dir install || exit 1; \ 61 | done; 62 | else 63 | echo No install needed 64 | endif 65 | 66 | uninstall: 67 | ifeq ($(SYSTEMSETUP), yes) 68 | @for dir in $(SUBDIRS); do \ 69 | $(MAKE) -C $$dir uninstall || exit 1; \ 70 | done; 71 | $(RM) -rf $(STEADPATH) 72 | else 73 | echo No uninstall needed 74 | endif 75 | -------------------------------------------------------------------------------- /Makefile.mingw: -------------------------------------------------------------------------------- 1 | MAKE=make 2 | ISCC = wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Inno\ Setup\ 5/ISCC.exe 3 | 4 | all: config.make src/windows 5 | $(MAKE) -C src/zlib all 6 | $(MAKE) -C src all 7 | $(MAKE) -C themes all 8 | 9 | src/windows: 10 | tar xzvf windows-sdl2.tar.gz 11 | 12 | config.make: 13 | echo "# you can define own flags here" > config.make 14 | 15 | clean: 16 | $(RM) -rf bin 17 | $(RM) -rf src/windows 18 | $(MAKE) -C src/sdl-instead clean 19 | 20 | docs: 21 | # $(MAKE) pdf -C doc/ 22 | # man doc/instead.6 > doc/instead.txt 23 | # $(MAKE) wiki -C doc/ 24 | 25 | install: all 26 | cp src/sdl-instead.exe bin 27 | cp COPYING bin 28 | $(MAKE) DESTDIR=../bin/ -C themes install 29 | $(MAKE) DESTDIR=../bin/ -C games install 30 | $(MAKE) DESTDIR=../bin/ -C stead install 31 | $(MAKE) DESTDIR=../bin/ -C icon install 32 | $(MAKE) DESTDIR=../bin/ -C lang install 33 | $(MAKE) DESTDIR=../bin/ -C doc install 34 | 35 | setup: install docs 36 | cp contrib/setup.iss bin 37 | cd bin; $(ISCC) setup.iss 38 | -------------------------------------------------------------------------------- /PKGBUILD.in: -------------------------------------------------------------------------------- 1 | # Contributor: Peter Kosyh 2 | 3 | pkgname=instead 4 | pkgver=3.5.2 5 | pkgrel=1 6 | pkgdesc="instead quest interpreter" 7 | arch=('i686' 'x86_64') 8 | url="http://instead.sourceforge.net/" 9 | license=('MIT') 10 | depends=('sdl2_image' 'sdl2_mixer' 'sdl2_ttf' 'lua') 11 | source=(http://downloads.sourceforge.net/project/instead/instead/${pkgver}/instead_${pkgver}.tar.gz) 12 | md5sums=(MD5SUM) 13 | 14 | optdepends=('instead-launcher: install and update INSTEAD games from net') 15 | 16 | build() { 17 | cd "${srcdir}/instead-${pkgver}" 18 | 19 | echo "2" | ./configure.sh 20 | make PREFIX=/usr 21 | } 22 | 23 | package() { 24 | cd "${srcdir}/instead-${pkgver}" 25 | 26 | make DESTDIR="${pkgdir}" PREFIX=/usr install 27 | } 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Build status](https://github.com/instead-hub/instead/actions/workflows/CI.yml/badge.svg) 2 | 3 | # INSTEAD 4 | 5 | This program is covered by the terms of the MIT license. 6 | 7 | Check the [COPYING](COPYING) file for license. 8 | 9 | Check the [INSTALL](INSTALL) file for install instructions. 10 | 11 | ## Web resources 12 | 13 | - [Homepage](https://instead-hub.github.io) 14 | - [Code](https://github.com/instead-hub/instead) 15 | - [Community](https://instead-games.ru) 16 | - [Documentation](https://instead-hub.github.io/#doc) 17 | 18 | ## Install games 19 | 20 | To run games you may: 21 | 22 | - Unzip game archive into ~/.instead/games/; 23 | - Or run zip-packed game: $ instead ; 24 | - Or press [f4] to open file dialog (build with gtk2/gtl3 only). 25 | 26 | ## Contacts 27 | 28 | - Join the irc channel #instead on irc.oftc.net; 29 | - Check the [AUTHORS](AUTHORS) file. 30 | -------------------------------------------------------------------------------- /Rules.make.macosx: -------------------------------------------------------------------------------- 1 | VERSION := 3.5.2 2 | 3 | DESTDIR= 4 | BIN= 5 | DATAPATH=__private__ 6 | STEADPATH=$(DATAPATH)/stead 7 | THEMESPATH=$(DATAPATH)/themes 8 | GAMESPATH=$(DATAPATH)/games 9 | ICONPATH=$(DATAPATH)/icon 10 | LANGPATH=$(DATAPATH)/lang 11 | DOCPATH= 12 | MANPATH= 13 | SYSTEMSETUP=no 14 | 15 | ZLIB_CFLAGS= 16 | ZLIB_LFLAGS=-lz 17 | 18 | LUA_CFLAGS=$(shell pkg-config --cflags lua5.1) 19 | LUA_LFLAGS=$(shell pkg-config --libs lua5.1) 20 | 21 | # for arch linux, fedora (may be others) use this 22 | # 23 | # LUA_CFLAGS=$(shell pkg-config --cflags lua) 24 | # LUA_LFLAGS=$(shell pkg-config --libs lua) 25 | # 26 | 27 | SDL_CFLAGS=$(shell sdl2-config --cflags) 28 | SDL_LFLAGS=$(shell sdl2-config --libs) -lSDL2_ttf -lSDL2_mixer -lSDL2_image 29 | 30 | CFLAGS += -Wall -Dunix -D_USE_UNPACK -D_USE_BROWSE 31 | 32 | INSTALLD=echo "Do not install standalone version!" 33 | INSTALLB=echo "Do not install standalone version!" 34 | INSTALL=echo "Do not install standalone version!" 35 | LN=echo "Do not install standalone version!" 36 | 37 | EXE= 38 | PLATFORM=macosx.m 39 | ADDOBJ=macosx.o 40 | 41 | macosx.o : macosx.m 42 | $(CC) -c $(<) $(I) $(CFLAGS) 43 | 44 | RESOURCES= 45 | RM=rm 46 | AR=ar rc 47 | RANLIB=ranlib 48 | -------------------------------------------------------------------------------- /Rules.make.standalone: -------------------------------------------------------------------------------- 1 | VERSION := 3.5.2 2 | 3 | DESTDIR= 4 | BIN= 5 | DATAPATH=. 6 | STEADPATH=$(DATAPATH)/stead 7 | THEMESPATH=$(DATAPATH)/themes 8 | GAMESPATH=$(DATAPATH)/games 9 | ICONPATH=$(DATAPATH)/icon 10 | LANGPATH=$(DATAPATH)/lang 11 | DOCPATH= 12 | MANPATH= 13 | SYSTEMSETUP=no 14 | 15 | ZLIB_CFLAGS= 16 | ZLIB_LFLAGS=-lz 17 | 18 | LUA_CFLAGS=$(shell pkg-config --cflags lua5.1) 19 | LUA_LFLAGS=$(shell pkg-config --libs lua5.1) 20 | 21 | # for arch linux, fedora (may be others) use this 22 | # 23 | # LUA_CFLAGS=$(shell pkg-config --cflags lua) 24 | # LUA_LFLAGS=$(shell pkg-config --libs lua) 25 | # 26 | 27 | SDL_CFLAGS=$(shell sdl2-config --cflags) 28 | SDL_LFLAGS=$(shell sdl2-config --libs) -lSDL2_ttf -lSDL2_mixer -lSDL2_image -lm 29 | 30 | CFLAGS += -O2 -Wall -Dunix -D_USE_UNPACK -D_LOCAL_APPDATA 31 | 32 | INSTALLD=echo "Do not install standalone version!" 33 | INSTALLB=echo "Do not install standalone version!" 34 | INSTALL=echo "Do not install standalone version!" 35 | LN=echo "Do not install standalone version!" 36 | 37 | EXE= 38 | PLATFORM=unix.c 39 | RESOURCES= 40 | RM=rm 41 | AR=ar rc 42 | RANLIB=ranlib 43 | -------------------------------------------------------------------------------- /Rules.make.system: -------------------------------------------------------------------------------- 1 | VERSION := 3.5.2 2 | 3 | PREFIX=/usr/local 4 | DESTDIR= 5 | BIN=$(PREFIX)/bin/ 6 | DATAPATH=$(PREFIX)/share/instead 7 | STEADPATH=$(DATAPATH)/stead 8 | THEMESPATH=$(DATAPATH)/themes 9 | GAMESPATH=$(DATAPATH)/games 10 | ICONPATH=$(PREFIX)/share/pixmaps 11 | DOCPATH=$(PREFIX)/share/doc/instead 12 | LANGPATH=$(DATAPATH)/lang 13 | MANPATH=$(PREFIX)/share/man/man6 14 | SYSTEMSETUP=yes 15 | 16 | ZLIB_CFLAGS= 17 | ZLIB_LFLAGS=-lz 18 | 19 | LUA_CFLAGS=$(shell pkg-config --cflags lua5.1) 20 | LUA_LFLAGS=$(shell pkg-config --libs lua5.1) 21 | 22 | # for arch and gentoo linux use this 23 | # 24 | # LUA_CFLAGS=$(shell pkg-config --cflags lua) 25 | # LUA_LFLAGS=$(shell pkg-config --libs lua) 26 | # 27 | 28 | SDL_CFLAGS=$(shell sdl2-config --cflags) 29 | SDL_LFLAGS=$(shell sdl2-config --libs) -lSDL2_ttf -lSDL2_mixer -lSDL2_image -lm 30 | 31 | CFLAGS += -Wall -Dunix -D_USE_UNPACK # -D_SDL_MOD_BUG 32 | 33 | INSTALLD=install -d -m 0755 34 | INSTALLB=install -m 0755 35 | INSTALL=install -m 0644 36 | LN=ln -sf 37 | 38 | EXE= 39 | PLATFORM=unix.c 40 | RESOURCES= 41 | RM=rm 42 | AR=ar rc 43 | RANLIB=ranlib 44 | -------------------------------------------------------------------------------- /Rules.mingw: -------------------------------------------------------------------------------- 1 | VERSION := 3.5.2 2 | 3 | PREFIX=./ 4 | DESTDIR= 5 | 6 | BIN=$(PREFIX) 7 | STEADPATH=$(PREFIX)stead 8 | THEMESPATH=$(PREFIX)themes 9 | GAMESPATH=$(PREFIX)games 10 | ICONPATH=$(PREFIX)icon 11 | DOCPATH=$(PREFIX)doc 12 | LANGPATH=$(PREFIX)lang 13 | MANPATH=$(PREFIX)doc 14 | WINDOWS=yes 15 | 16 | ZLIB_CFLAGS=-Izlib 17 | ZLIB_LFLAGS=zlib/libz.a 18 | 19 | LUA_CFLAGS=-I./windows/ 20 | LUA_LFLAGS=-llua5.1 -L./windows/ 21 | 22 | SDL_CFLAGS=-I./windows/SDL 23 | SDL_LFLAGS=-lSDL2 -lSDL2main -lSDL2_ttf -lSDL2_mixer -lSDL2_image -L./windows/SDL 24 | 25 | CFLAGS += -Wall -mwindows -D_HAVE_ICONV -D_USE_UNPACK -D_USE_BROWSE -D_LOCAL_APPDATA 26 | LDFLAGS += -liconv 27 | 28 | MINGW=i686-w64-mingw32- 29 | CC=$(MINGW)gcc 30 | AR=$(MINGW)ar rc 31 | RANLIB=$(MINGW)ranlib 32 | 33 | RM=rm 34 | EXE=.exe 35 | 36 | INSTALLD=install -d -m 0755 37 | INSTALLB=install -m 0755 38 | INSTALL=install -m 0644 39 | LN=echo 40 | 41 | PLATFORM=windows.c iowin32.c 42 | RESOURCES=resources.o 43 | 44 | resources.o: resources.rc 45 | $(MINGW)windres -i resources.rc -o resources.o 46 | -------------------------------------------------------------------------------- /cmake/FindGLIB.cmake: -------------------------------------------------------------------------------- 1 | # - Try to locate glib3 2 | # This module defines: 3 | # 4 | # GLIB_INCLUDE_DIRS 5 | # GLIB_LIBRARIES 6 | # GLIB_FOUND 7 | # GLIB_DEFINITIONS 8 | # 9 | 10 | FIND_PACKAGE(PkgConfig) 11 | 12 | PKG_CHECK_MODULES(PC_GLIB REQUIRED glib-2.0) 13 | 14 | SET(GLIB_INCLUDE_DIRS ${PC_GLIB_INCLUDE_DIRS}) 15 | 16 | FOREACH(LIB ${PC_GLIB_LIBRARIES}) 17 | FIND_LIBRARY(FOUND${LIB} HINTS ${PC_GLIB_LIBRARY_DIRS} NAMES ${LIB}) 18 | LIST(APPEND GLIB_LIBRARIES ${FOUND${LIB}}) 19 | ENDFOREACH(LIB) 20 | 21 | IF(GLIB_INCLUDE_DIRS AND GLIB_LIBRARIES) 22 | SET(GLIB_FOUND TRUE) 23 | ENDIF(GLIB_INCLUDE_DIRS AND GLIB_LIBRARIES) 24 | 25 | IF(GLIB_FOUND) 26 | IF(NOT GLIB_FIND_QUIETLY) 27 | MESSAGE(STATUS "Found GLIB: -I${GLIB_INCLUDE_DIRS}, ${GLIB_LIBRARIES}") 28 | ENDIF(NOT GLIB_FIND_QUIETLY) 29 | ELSE(GLIB_FOUND) 30 | IF(GLIB_FIND_REQUIRED) 31 | MESSAGE(FATAL_ERROR "Could not find GLIB") 32 | ENDIF(GLIB_FIND_REQUIRED) 33 | ENDIF(GLIB_FOUND) 34 | 35 | MARK_AS_ADVANCED(GLIB_INCLUDE_DIRS GLIB_LIBRARIES GLIB_FOUND) 36 | -------------------------------------------------------------------------------- /cmake/FindGTK3.cmake: -------------------------------------------------------------------------------- 1 | # - Try to locate GTK3 2 | # This module defines: 3 | # 4 | # GTK3_INCLUDE_DIRS 5 | # GTK3_LIBRARIES 6 | # GTK3_FOUND 7 | # GTK3_DEFINITIONS 8 | # 9 | 10 | FIND_PACKAGE(PkgConfig) 11 | 12 | PKG_CHECK_MODULES(PC_GTK3 REQUIRED gtk+-3.0) 13 | 14 | SET(GTK3_INCLUDE_DIRS ${PC_GTK3_INCLUDE_DIRS}) 15 | 16 | FOREACH(LIB ${PC_GTK3_LIBRARIES}) 17 | FIND_LIBRARY(FOUND${LIB} HINTS ${PC_GTK3_LIBRARY_DIRS} NAMES ${LIB}) 18 | LIST(APPEND GTK3_LIBRARIES ${FOUND${LIB}}) 19 | ENDFOREACH(LIB) 20 | 21 | IF(GTK3_INCLUDE_DIRS AND GTK3_LIBRARIES) 22 | SET(GTK3_FOUND TRUE) 23 | ENDIF(GTK3_INCLUDE_DIRS AND GTK3_LIBRARIES) 24 | 25 | IF(GTK3_FOUND) 26 | IF(NOT GTK3_FIND_QUIETLY) 27 | MESSAGE(STATUS "Found GTK3: -I${GTK3_INCLUDE_DIRS}, ${GTK3_LIBRARIES}") 28 | ENDIF(NOT GTK3_FIND_QUIETLY) 29 | ELSE(GTK3_FOUND) 30 | IF(GTK3_FIND_REQUIRED) 31 | MESSAGE(FATAL_ERROR "Could not find GTK3") 32 | ENDIF(GTK3_FIND_REQUIRED) 33 | ENDIF(GTK3_FOUND) 34 | 35 | MARK_AS_ADVANCED(GTK3_INCLUDE_DIRS GTK3_LIBRARIES GTK3_FOUND) 36 | -------------------------------------------------------------------------------- /cmake/FindHarfBuzz.cmake: -------------------------------------------------------------------------------- 1 | # - Try to locate HarfBuzz 2 | # This module defines: 3 | # 4 | # HARFBUZZ_INCLUDE_DIR 5 | # HARFBUZZ_LIBRARY 6 | # HARFBUZZ_FOUND 7 | # 8 | 9 | FIND_PATH(HARFBUZZ_INCLUDE_DIR NAMES hb.h PATH_SUFFIXES harfbuzz) 10 | 11 | FIND_LIBRARY(HARFBUZZ_LIBRARY NAMES harfbuzz) 12 | 13 | IF(HARFBUZZ_INCLUDE_DIR AND HARFBUZZ_LIBRARY) 14 | SET(HARFBUZZ_FOUND TRUE) 15 | ENDIF(HARFBUZZ_INCLUDE_DIR AND HARFBUZZ_LIBRARY) 16 | 17 | IF(HARFBUZZ_FOUND) 18 | IF(NOT HarfBuzz_FIND_QUIETLY) 19 | MESSAGE(STATUS "Found HarfBuzz: -I${HARFBUZZ_INCLUDE_DIR}, ${HARFBUZZ_LIBRARY}") 20 | ENDIF(NOT HarfBuzz_FIND_QUIETLY) 21 | ELSE(HARFBUZZ_FOUND) 22 | IF(HarfBuzz_FIND_REQUIRED) 23 | MESSAGE(FATAL_ERROR "Could not find HarfBuzz") 24 | ENDIF(HarfBuzz_FIND_REQUIRED) 25 | ENDIF(HARFBUZZ_FOUND) 26 | 27 | MARK_AS_ADVANCED(HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY HARFBUZZ_FOUND) 28 | -------------------------------------------------------------------------------- /cmake/FindIconv.cmake: -------------------------------------------------------------------------------- 1 | # - Locate Iconv 2 | # This module defines: 3 | # 4 | # ICONV_INCLUDE_DIR 5 | # ICONV_LIBRARY 6 | # ICONV_FOUND 7 | # 8 | 9 | # Look for header file 10 | FIND_PATH(ICONV_INCLUDE_DIR NAMES iconv.h) 11 | 12 | # Check if library is needed 13 | IF(ICONV_INCLUDE_DIR) 14 | SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) 15 | TRY_COMPILE(ICONV_LIBRARY_NOT_NEEDED 16 | ${CMAKE_BINARY_DIR} 17 | ${CMAKE_MODULE_PATH}/iconv_test.c 18 | CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${ICONV_INCLUDE_DIR}" 19 | ) 20 | 21 | IF(NOT ICONV_LIBRARY_NOT_NEEDED) 22 | # Locate library 23 | FIND_LIBRARY(ICONV_LIBRARY NAMES iconv libiconv) 24 | 25 | IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARY) 26 | SET(ICONV_FOUND TRUE) 27 | ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARY) 28 | ELSE(NOT ICONV_LIBRARY_NOT_NEEDED) 29 | # Library not needed 30 | SET(ICONV_LIBRARY) 31 | 32 | IF(ICONV_INCLUDE_DIR) 33 | SET(ICONV_FOUND TRUE) 34 | ENDIF(ICONV_INCLUDE_DIR) 35 | ENDIF(NOT ICONV_LIBRARY_NOT_NEEDED) 36 | ENDIF(ICONV_INCLUDE_DIR) 37 | 38 | # Show status 39 | IF(ICONV_FOUND) 40 | IF(NOT Iconv_FIND_QUIETLY) 41 | IF(ICONV_LIBRARY_NOT_NEEDED) 42 | MESSAGE(STATUS "Found Iconv: -I${ICONV_INCLUDE_DIR}, library not needed") 43 | ELSE(ICONV_LIBRARY_NOT_NEEDED) 44 | MESSAGE(STATUS "Found Iconv: -I${ICONV_INCLUDE_DIR}, ${ICONV_LIBRARY}") 45 | ENDIF(ICONV_LIBRARY_NOT_NEEDED) 46 | ENDIF(NOT Iconv_FIND_QUIETLY) 47 | ELSE(ICONV_FOUND) 48 | IF(Iconv_FIND_REQUIRED) 49 | MESSAGE(FATAL_ERROR "Could not find ICONV") 50 | ENDIF(Iconv_FIND_REQUIRED) 51 | ENDIF(ICONV_FOUND) 52 | 53 | MARK_AS_ADVANCED(ICONV_INCLUDE_DIR ICONV_LIBRARY ICONV_FOUND) 54 | -------------------------------------------------------------------------------- /cmake/FindLuaJIT.cmake: -------------------------------------------------------------------------------- 1 | # Locate LuaJIT library 2 | # This module defines 3 | # LUAJIT_FOUND, if false, do not try to link to Lua 4 | # LUA_LIBRARIES 5 | # LUA_INCLUDE_DIR, where to find lua.h 6 | # LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8) 7 | 8 | ## Copied from default CMake FindLua51.cmake 9 | 10 | find_path(LUA_INCLUDE_DIR luajit.h 11 | HINTS 12 | ENV LUA_DIR 13 | PATH_SUFFIXES include/luajit-2.0 include/luajit-2.1 include 14 | PATHS 15 | ~/Library/Frameworks 16 | /Library/Frameworks 17 | /sw # Fink 18 | /opt/local # DarwinPorts 19 | /opt/csw # Blastwave 20 | /opt 21 | ) 22 | 23 | find_library(LUA_LIBRARY 24 | NAMES luajit-5.1 25 | HINTS 26 | ENV LUA_DIR 27 | PATH_SUFFIXES lib 28 | PATHS 29 | ~/Library/Frameworks 30 | /Library/Frameworks 31 | /sw 32 | /opt/local 33 | /opt/csw 34 | /opt 35 | ) 36 | 37 | if(LUA_LIBRARY) 38 | # include the math library for Unix 39 | if(UNIX AND NOT APPLE) 40 | find_library(LUA_MATH_LIBRARY m) 41 | set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") 42 | # For Windows and Mac, don't need to explicitly include the math library 43 | else() 44 | set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") 45 | endif() 46 | endif() 47 | 48 | if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h") 49 | file(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" luajit_version_str REGEX "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT .+\"") 50 | 51 | string(REGEX REPLACE "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${luajit_version_str}") 52 | unset(luajit_version_str) 53 | endif() 54 | 55 | include(FindPackageHandleStandardArgs) 56 | # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if 57 | # all listed variables are TRUE 58 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT 59 | REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR 60 | VERSION_VAR LUAJIT_VERSION_STRING) 61 | 62 | mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) 63 | 64 | -------------------------------------------------------------------------------- /cmake/FindSDL2.cmake: -------------------------------------------------------------------------------- 1 | # - Try to locate SDL2 2 | # This module defines: 3 | # 4 | # SDL2_INCLUDE_DIR 5 | # SDL2_LIBRARY 6 | # SDL2_FOUND 7 | # 8 | 9 | FIND_PATH(SDL2_INCLUDE_DIR NAMES SDL.h PATH_SUFFIXES SDL2) 10 | 11 | FIND_LIBRARY(SDL2_LIBRARY NAMES SDL2) 12 | 13 | IF(SDL2_INCLUDE_DIR AND SDL2_LIBRARY) 14 | SET(SDL2_FOUND TRUE) 15 | ENDIF(SDL2_INCLUDE_DIR AND SDL2_LIBRARY) 16 | 17 | IF(SDL2_FOUND) 18 | IF(NOT SDL2_FIND_QUIETLY) 19 | MESSAGE(STATUS "Found SDL2: -I${SDL2_INCLUDE_DIR}, ${SDL2_LIBRARY}") 20 | ENDIF(NOT SDL2_FIND_QUIETLY) 21 | ELSE(SDL2_FOUND) 22 | IF(SDL2_FIND_REQUIRED) 23 | MESSAGE(FATAL_ERROR "Could not find SDL2") 24 | ENDIF(SDL2_FIND_REQUIRED) 25 | ENDIF(SDL2_FOUND) 26 | 27 | MARK_AS_ADVANCED(SDL2_INCLUDE_DIR SDL2_LIBRARY SDL2_FOUND) 28 | -------------------------------------------------------------------------------- /cmake/FindSDL2_image.cmake: -------------------------------------------------------------------------------- 1 | # - Try to locate SDL2_image 2 | # This module defines: 3 | # 4 | # SDL2IMAGE_INCLUDE_DIR 5 | # SDL2IMAGE_LIBRARY 6 | # SDL2IMAGE_FOUND 7 | # 8 | 9 | FIND_PATH(SDL2IMAGE_INCLUDE_DIR NAMES SDL_image.h PATH_SUFFIXES SDL2) 10 | 11 | FIND_LIBRARY(SDL2IMAGE_LIBRARY NAMES SDL2_image) 12 | 13 | IF(SDL2IMAGE_INCLUDE_DIR AND SDL2IMAGE_LIBRARY) 14 | SET(SDL2IMAGE_FOUND TRUE) 15 | ENDIF(SDL2IMAGE_INCLUDE_DIR AND SDL2IMAGE_LIBRARY) 16 | 17 | IF(SDL2IMAGE_FOUND) 18 | IF(NOT SDL2_image_FIND_QUIETLY) 19 | MESSAGE(STATUS "Found SDL2_image: -I${SDL2IMAGE_INCLUDE_DIR}, ${SDL2IMAGE_LIBRARY}") 20 | ENDIF(NOT SDL2_image_FIND_QUIETLY) 21 | ELSE(SDL2IMAGE_FOUND) 22 | IF(SDL2_image_FIND_REQUIRED) 23 | MESSAGE(FATAL_ERROR "Could not find SDL2_image") 24 | ENDIF(SDL2_image_FIND_REQUIRED) 25 | ENDIF(SDL2IMAGE_FOUND) 26 | 27 | MARK_AS_ADVANCED(SDL2IMAGE_INCLUDE_DIR SDL2IMAGE_LIBRARY SDL2IMAGE_FOUND) 28 | -------------------------------------------------------------------------------- /cmake/FindSDL2_mixer.cmake: -------------------------------------------------------------------------------- 1 | # - Try to locate SDL2_mixer 2 | # This module defines: 3 | # 4 | # SDL2MIXER_INCLUDE_DIR 5 | # SDL2MIXER_LIBRARY 6 | # SDL2MIXER_FOUND 7 | # 8 | 9 | FIND_PATH(SDL2MIXER_INCLUDE_DIR NAMES SDL_mixer.h PATH_SUFFIXES SDL2) 10 | 11 | FIND_LIBRARY(SDL2MIXER_LIBRARY NAMES SDL2_mixer) 12 | 13 | IF(SDL2MIXER_INCLUDE_DIR AND SDL2MIXER_LIBRARY) 14 | SET(SDL2MIXER_FOUND TRUE) 15 | ENDIF(SDL2MIXER_INCLUDE_DIR AND SDL2MIXER_LIBRARY) 16 | 17 | IF(SDL2MIXER_FOUND) 18 | IF(NOT SDL2_mixer_FIND_QUIETLY) 19 | MESSAGE(STATUS "Found SDL2_mixer: -I${SDL2MIXER_INCLUDE_DIR}, ${SDL2MIXER_LIBRARY}") 20 | ENDIF(NOT SDL2_mixer_FIND_QUIETLY) 21 | ELSE(SDL2MIXER_FOUND) 22 | IF(SDL2_mixer_FIND_REQUIRED) 23 | MESSAGE(FATAL_ERROR "Could not find SDL2_mixer") 24 | ENDIF(SDL2_mixer_FIND_REQUIRED) 25 | ENDIF(SDL2MIXER_FOUND) 26 | 27 | MARK_AS_ADVANCED(SDL2MIXER_INCLUDE_DIR SDL2MIXER_LIBRARY SDL2MIXER_FOUND) 28 | -------------------------------------------------------------------------------- /cmake/FindSDL2_ttf.cmake: -------------------------------------------------------------------------------- 1 | # - Try to locate SDL2_ttf 2 | # This module defines: 3 | # 4 | # SDL2TTF_INCLUDE_DIR 5 | # SDL2TTF_LIBRARY 6 | # SDL2TTF_FOUND 7 | # 8 | 9 | FIND_PATH(SDL2TTF_INCLUDE_DIR NAMES SDL_ttf.h PATH_SUFFIXES SDL2) 10 | 11 | FIND_LIBRARY(SDL2TTF_LIBRARY NAMES SDL2_ttf) 12 | 13 | IF(SDL2TTF_INCLUDE_DIR AND SDL2TTF_LIBRARY) 14 | SET(SDL2TTF_FOUND TRUE) 15 | ENDIF(SDL2TTF_INCLUDE_DIR AND SDL2TTF_LIBRARY) 16 | 17 | IF(SDL2TTF_FOUND) 18 | IF(NOT SDL2_ttf_FIND_QUIETLY) 19 | MESSAGE(STATUS "Found SDL2_ttf: -I${SDL2TTF_INCLUDE_DIR}, ${SDL2TTF_LIBRARY}") 20 | ENDIF(NOT SDL2_ttf_FIND_QUIETLY) 21 | ELSE(SDL2TTF_FOUND) 22 | IF(SDL2_ttf_FIND_REQUIRED) 23 | MESSAGE(FATAL_ERROR "Could not find SDL2_ttf") 24 | ENDIF(SDL2_ttf_FIND_REQUIRED) 25 | ENDIF(SDL2TTF_FOUND) 26 | 27 | MARK_AS_ADVANCED(SDL2TTF_INCLUDE_DIR SDL2TTF_LIBRARY SDL2TTF_FOUND) 28 | -------------------------------------------------------------------------------- /cmake/InstallSymlink.cmake: -------------------------------------------------------------------------------- 1 | MACRO(INSTALL_SYMLINK linktarget linkname destination) 2 | IF(UNIX) 3 | IF(IS_ABSOLUTE ${destination}) 4 | SET(FULL_DESTINATION "\$ENV{DESTDIR}${destination}/${linkname}") 5 | ELSE(IS_ABSOLUTE ${destination}) 6 | SET(FULL_DESTINATION "\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${destination}/${linkname}") 7 | ENDIF(IS_ABSOLUTE ${destination}) 8 | 9 | INSTALL(CODE "MESSAGE(STATUS \"Symlink: ${FULL_DESTINATION} -> ${linktarget}\") 10 | EXECUTE_PROCESS(COMMAND \${CMAKE_COMMAND} -E create_symlink ${linktarget} ${FULL_DESTINATION})") 11 | ENDIF() 12 | ENDMACRO() 13 | -------------------------------------------------------------------------------- /cmake/iconv_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | iconv_open("", ""); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /configure-mingw32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -f config.make 3 | rm -f Rules.make 4 | ln -sf Rules.mingw Rules.make 5 | rm -f sdl-instead 6 | ln -sf src/sdl-instead sdl-instead 7 | echo "Ok. We are ready to build. Use this command:" 8 | echo " \$ make -f Makefile.mingw setup" 9 | -------------------------------------------------------------------------------- /contrib/appimage.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/contrib/appimage.tar.gz -------------------------------------------------------------------------------- /contrib/instead-em.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/contrib/instead-em.zip -------------------------------------------------------------------------------- /contrib/instead-sailfish-game.spec: -------------------------------------------------------------------------------- 1 | Summary: Color Lines game 2 | Name: instead-ilines 3 | Version: 1.1 4 | Release: 1%{?dist} 5 | License: GPL 6 | URL: http://instead-games.ru 7 | Source0: %{name}-%{version}.zip 8 | Group: Amusements/Games 9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 10 | BuildArch: noarch 11 | Requires: instead 12 | 13 | %description 14 | Classic Color Lines game 15 | 16 | %prep 17 | cd %{_builddir} 18 | b=`echo %{name} | sed -e 's/instead-//g'` 19 | rm -rf %{name} 20 | unzip %{name}-%{version}.zip 21 | mv "$b" %{name} 22 | 23 | %setup 24 | 25 | %build 26 | 27 | %install 28 | rm -rf $RPM_BUILD_ROOT 29 | install -d -m 0755 $RPM_BUILD_ROOT/usr/share/instead/games/%{name} 30 | cd %{name} 31 | tar cf - . | (cd $RPM_BUILD_ROOT/usr/share/instead/games/%{name} && tar xBf -) 32 | 33 | cat >%{name}.desktop <>config.make </home/nemo/.instead/profile < 5 | Build-Depends: debhelper (>= 7), pkg-config, liblua5.1-dev, libsdl2-dev, libsdl2-ttf-dev, libsdl2-image-dev, libsdl2-mixer-dev, zlib1g-dev 6 | Standards-Version: 3.8.3 7 | Homepage: http://instead.sourceforge.net 8 | 9 | Package: instead 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Description: simple text adventures/visual novels engine 13 | Visual novell/text quest-like engine. 14 | 15 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Peter Kosyh p.kosyh@gmail.com on 2 | Thu, 21 May 2009 11:40:29 +0400. 3 | 4 | It was downloaded from http://instead.sourceforge.net 5 | 6 | Upstream Author: 7 | 8 | p.kosyh@gmail.com 9 | 10 | Copyright: 11 | 12 | Copyright (C) 2009 Peter Kosyh 13 | 14 | License: 15 | 16 | MIT 17 | 18 | The Debian packaging is (C) 2009, Peter Kosyh p.kosyh@gmail.com and 19 | is licensed under the MIT, see `/usr/share/common-licenses/MIT'. 20 | 21 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | 13 | 14 | 15 | 16 | configure: configure-stamp 17 | configure-stamp: 18 | dh_testdir 19 | # Add here commands to configure the package. 20 | 21 | touch configure-stamp 22 | 23 | build: build-arch build-indep 24 | 25 | build-arch: build-stamp 26 | 27 | build-indep: build-stamp 28 | 29 | build-stamp: configure-stamp 30 | dh_testdir 31 | 32 | # Add here commands to compile the package. 33 | ln -s instead.6 doc/sdl-instead.6 34 | ln -s instead.txt doc/sdl-instead.txt 35 | 36 | rm -rf Rules.make 37 | ln -s Rules.make.system Rules.make 38 | echo "2" | ./configure.sh 39 | $(MAKE) PREFIX=/usr BIN=/usr/games DATAPATH=/usr/share/games/instead 40 | rm -rf Rules.make 41 | #docbook-to-man debian/instead.sgml > instead.1 42 | touch $@ 43 | 44 | clean: 45 | dh_testdir 46 | dh_testroot 47 | rm -f build-stamp configure-stamp 48 | 49 | # Add here commands to clean up after the build process. 50 | rm -rf doc/sdl-instead.6 51 | rm -rf doc/sdl-instead.txt 52 | 53 | rm -rf Rules.make 54 | ln -s Rules.make.system Rules.make 55 | $(MAKE) clean 56 | rm -rf Rules.make 57 | ln -s Rules.make.standalone Rules.make 58 | 59 | dh_clean 60 | 61 | install: build 62 | dh_testdir 63 | dh_testroot 64 | dh_prep 65 | dh_installdirs 66 | 67 | # Add here commands to install the package into debian/instead. 68 | rm -rf Rules.make 69 | ln -s Rules.make.system Rules.make 70 | $(MAKE) install DESTDIR=$(CURDIR)/debian/instead PREFIX=/usr DATAPATH=/usr/share/games/instead BIN=/usr/games 71 | rm -rf Rules.make 72 | 73 | 74 | # Build architecture-independent files here. 75 | binary-indep: build install 76 | # We have nothing to do by default. 77 | 78 | # Build architecture-dependent files here. 79 | binary-arch: build install 80 | dh_testdir 81 | dh_testroot 82 | dh_installchangelogs 83 | dh_installdocs 84 | dh_installexamples 85 | # dh_install 86 | # dh_installmenu 87 | # dh_installdebconf 88 | # dh_installlogrotate 89 | # dh_installemacsen 90 | # dh_installpam 91 | # dh_installmime 92 | # dh_python 93 | # dh_installinit 94 | # dh_installcron 95 | # dh_installinfo 96 | dh_installman 97 | dh_link 98 | dh_strip 99 | dh_compress 100 | dh_fixperms 101 | # dh_perl 102 | # dh_makeshlibs 103 | dh_installdeb 104 | dh_shlibdeps 105 | dh_gencontrol 106 | dh_md5sums 107 | dh_builddeb 108 | 109 | binary: binary-indep binary-arch 110 | .PHONY: build clean binary-indep binary-arch binary install configure 111 | -------------------------------------------------------------------------------- /desktop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | IF(SYSTEMWIDE) 2 | SET(BIN ${CMAKE_INSTALL_PREFIX}/${BINDIR}) # for following CONFIGURE_FILE 3 | CONFIGURE_FILE(instead.desktop.in instead.desktop) 4 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/instead.desktop DESTINATION ${DESKTOPDIR}) 5 | ENDIF(SYSTEMWIDE) 6 | -------------------------------------------------------------------------------- /desktop/Makefile: -------------------------------------------------------------------------------- 1 | include ../Rules.make 2 | include ../config.make 3 | 4 | clean: 5 | rm -rf instead.desktop 6 | 7 | all: instead.desktop 8 | 9 | instead.desktop: instead.desktop.in 10 | cat instead.desktop.in | sed -e "s|@BIN@|$(BIN)|g" > instead.desktop 11 | 12 | install: 13 | $(INSTALLD) $(DESTDIR)$(PREFIX)/share/applications 14 | $(INSTALL) instead.desktop $(DESTDIR)$(PREFIX)/share/applications/instead.desktop 15 | 16 | uninstall: 17 | $(RM) $(DESTDIR)$(PREFIX)/share/applications/instead.desktop 18 | 19 | -------------------------------------------------------------------------------- /desktop/instead.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=INSTEAD 5 | Name[ru]=INSTEAD 6 | Name[uk]=INSTEAD 7 | Comment=Simple Text Adventures Interpreter 8 | Comment[ru]=Интерпретатор простых приключений 9 | Comment[uk]=Iнтерпретатор простих пригод 10 | Keywords=game;adventure;quest; 11 | Keywords[ru]=игра;приключения;квест; 12 | Keywords[uk]=гра;пригоди;квест; 13 | Exec=@BIN@/sdl-instead 14 | Icon=sdl_instead 15 | Terminal=false 16 | Categories=Game;LogicGame; 17 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(DOC_FILES 2 | 3 | ) 4 | 5 | SET(GENERATED_DOC_FILES 6 | stead3-ru.pdf 7 | modules3-ru.pdf 8 | stead3-en.pdf 9 | instead.txt 10 | ) 11 | 12 | FOREACH(FILE ${GENERATED_DOC_FILES}) 13 | IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) 14 | SET(DOC_FILES ${DOC_FILES} ${FILE}) 15 | ELSE(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) 16 | SET(MISSING_FILES ${MISSING_FILES} ${FILE}) 17 | ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) 18 | ENDFOREACH(FILE ${GENERATED_DOC_FILES}) 19 | 20 | IF(NOT "${MISSING_FILES}" STREQUAL "") 21 | MESSAGE(WARNING "This distribution lacks some documentation files: ${MISSING_FILES}. These may be generated (network access and additional tools required, see doc/makepdfs), or you may use instead source tarball from sourceforge which has these files included") 22 | ENDIF(NOT "${MISSING_FILES}" STREQUAL "") 23 | 24 | IF(SYSTEMWIDE) 25 | INSTALL(FILES ${DOC_FILES} DESTINATION ${DOCDIR}) 26 | INSTALL(FILES instead.6 DESTINATION ${MANDIR}/man6) 27 | ELSEIF(STANDALONE) 28 | INSTALL(FILES ${DOC_FILES} DESTINATION ${STANDALONEDIR}/doc) 29 | ENDIF(SYSTEMWIDE) 30 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | include ../Rules.make 2 | include ../config.make 3 | 4 | all: 5 | 6 | clean: 7 | rm -f *.aux *.log *.out *.toc stead3-manual-ru.tex modules3-manual-ru.tex stead3-manual-en.tex 8 | # rm -f *.pdf instead.txt 9 | 10 | stead3-manual-ru.tex: stead3-ru.md 11 | multimarkdown stead3-ru.md -t latex -o stead3-manual-ru.tex 12 | 13 | stead3-ru.pdf: stead3-ru.tex stead3-manual-ru.tex 14 | xelatex stead3-ru.tex 15 | xelatex stead3-ru.tex 16 | xelatex stead3-ru.tex 17 | 18 | modules3-manual-ru.tex: modules3-ru.md 19 | multimarkdown modules3-ru.md -t latex -o modules3-manual-ru.tex 20 | 21 | modules3-ru.pdf: modules3-ru.tex modules3-manual-ru.tex 22 | xelatex modules3-ru.tex 23 | xelatex modules3-ru.tex 24 | xelatex modules3-ru.tex 25 | 26 | stead3-manual-en.tex: stead3-en.md 27 | multimarkdown stead3-en.md -t latex -o stead3-manual-en.tex 28 | 29 | stead3-en.pdf: stead3-en.tex stead3-manual-en.tex 30 | xelatex stead3-en.tex 31 | xelatex stead3-en.tex 32 | xelatex stead3-en.tex 33 | 34 | pdf: stead3-ru.pdf modules3-ru.pdf stead3-en.pdf 35 | rm -f *.aux *.log *.out *.toc stead3-manual-ru.tex modules3-manual-ru.tex stead3-manual-en.tex 36 | 37 | man: 38 | man ./instead.6 | col -b > instead.txt 39 | 40 | docs: man pdf 41 | 42 | install: 43 | $(INSTALLD) $(DESTDIR)$(DOCPATH) 44 | -$(INSTALL) instead.txt *.pdf $(DESTDIR)$(DOCPATH) 45 | 46 | $(INSTALLD) $(DESTDIR)$(MANPATH) 47 | $(INSTALL) *.6 $(DESTDIR)$(MANPATH) 48 | 49 | uninstall: 50 | $(RM) -rf $(DESTDIR)$(DOCPATH) 51 | $(RM) $(DESTDIR)$(MANPATH)/instead.* 52 | -------------------------------------------------------------------------------- /doc/examples/stead2/keyboard/main.lua: -------------------------------------------------------------------------------- 1 | instead_version "1.7.0" 2 | require "keyboard" 3 | require "xact" 4 | 5 | input.verbose = true 6 | main = room { 7 | nam = '?'; 8 | dsc = function(s) 9 | if read.text ~= '' then 10 | p "Привет, " 11 | p (read.text,"!") 12 | else 13 | p [[Как вас {xwalk(read)|зовут}?]]; 14 | end 15 | end 16 | } 17 | 18 | read = keyboard { 19 | nam = 'Имя:'; 20 | msg = "Поле ввода:"; 21 | } 22 | -------------------------------------------------------------------------------- /doc/examples/stead2/menu-demo/main.lua: -------------------------------------------------------------------------------- 1 | instead_version "1.6.3" 2 | require "proxymenu" 3 | require "hideinv" 4 | 5 | game.forcedsc = true 6 | 7 | minv = obj_menu('С СОБОЙ', 'exam', false, true); 8 | mlook = obj_menu('ОСМОТРЕТЬ', 'exam', true); 9 | mtake = obj_menu('ВЗЯТЬ', 'take', true); 10 | mdrop = obj_menu('БРОСИТЬ', 'drop', false, true); 11 | meat = obj_menu('ЕСТЬ', 'eat', true, true); 12 | mpush = obj_menu('ТОЛКАТЬ', 'push', true); 13 | muse = use_menu('ИСПОЛЬЗОВАТЬ', 'useon', 'used', 'useit', true, true); 14 | mgive = use_menu('ОТДАТЬ', 'give', 'accept', false, true, true, true); 15 | mwalk = obj_menu('ИДТИ', 'walk', false, false, true); 16 | 17 | game.useit = 'Не помогло.' 18 | game.use = 'Не сработает.' 19 | game.give = 'Отдать? Ни за что!' 20 | game.eat = 'Не буду это есть.' 21 | game.drop = 'Еще пригодится.' 22 | game.exam = 'Ничего необычного.' 23 | game.take = 'Стоит ли это брать?' 24 | game.push = 'Ничего не произошло.' 25 | 26 | game.after_take = function(s, w) 27 | take(w) 28 | end 29 | 30 | game.after_drop = function(s, w) 31 | drop(w) 32 | end 33 | 34 | put(minv, me()) 35 | put(mlook, me()) 36 | put(mtake, me()) 37 | put(mdrop, me()) 38 | put(meat, me()) 39 | put(mpush, me()) 40 | put(muse, me()) 41 | put(mgive, me()) 42 | -- put(mwalk, me()) 43 | 44 | status = stat { 45 | _Turns = 0, 46 | life = function(s) 47 | s._Turns = s._Turns + 1; 48 | end; 49 | nam = function(s) 50 | return 'Статус игрока: '..s._Turns..'^'; 51 | end 52 | }; 53 | lifeon 'status' 54 | 55 | put(status, me()); 56 | 57 | knife = obj { 58 | nam = 'ножик', 59 | dsc = 'На полу валяется ножик.', 60 | exam = 'Бесполезный перочинный ножик.', 61 | } 62 | 63 | main = room { 64 | nam = 'intro', 65 | hideinv = "true", 66 | dsc = 'Введение', 67 | exit = function(s) 68 | inv():add('knife'); 69 | end, 70 | obj = { vway('next','{Дальше}.', 'r1') } 71 | } 72 | 73 | cube = obj { 74 | nam = 'куб', 75 | dsc = 'В центре комнаты находится куб.', 76 | take = 'Вы взяли куб', 77 | exam = 'Мультифункциональный куб -- написано на кубе.', 78 | drop = 'Вы положили куб.', 79 | useit = 'Как можно использовать куб?', 80 | talk = 'Вы поговорили с кубом.', 81 | eat = function(s) 82 | return 'Вы не можете разгрызть куб.', false; 83 | end, 84 | open = 'Вы открыли куб.', 85 | close = 'Вы закрыли куб.', 86 | push = 'Вы толкаете куб.', 87 | give = function(s, w) 88 | return 'Вы пытаетесь отдать куб объекту: '..deref(w)..'.', false 89 | end, 90 | useon = function(s, w) 91 | return 'Вы пытаетесь юзать куб на объект: '..deref(w)..'. Получилось!' 92 | end, 93 | used = 'Куб поюзан.', 94 | }; 95 | 96 | sphere = obj { 97 | nam = 'сфера', 98 | dsc = 'В центре комнаты находится сфера.', 99 | take = 'Вы взяли сферу', 100 | exam = 'Мультифункциональная сфера -- написано на сфере.', 101 | drop = 'Вы положили сферу.', 102 | useit = 'Как можно использовать сферу?', 103 | talk = 'Вы поговорили с сферой.', 104 | eat = function(s) 105 | return 'Вы не можете разгрызть сферу.', false; 106 | end, 107 | open = 'Вы открыли сферу.', 108 | close = 'Вы закрыли сферу.', 109 | push = 'Вы толкаете сферу.', 110 | give = function(s, w) 111 | return 'Вы пытаетесь отдать сферу объекту: '..nameof(w)..'.', false 112 | end, 113 | useon = function(s, w) 114 | return 'Вы пытаетесь юзать сферу на объект: '..nameof(w)..'. Получилось!' 115 | end, 116 | used = 'Сфера поюзана.', 117 | }; 118 | 119 | r1 = room { 120 | nam = 'комната', 121 | dsc = 'Вы в комнате', 122 | obj = { cube, sphere }, 123 | } 124 | -------------------------------------------------------------------------------- /doc/examples/stead2/trigger.lua: -------------------------------------------------------------------------------- 1 | -- example module 2 | function trigger(act, cond) 3 | local v = {} 4 | v.nam = 'trigger'; 5 | if not act then 6 | error("Wrong parameter to trigger.", 2) 7 | end 8 | v.act = act; 9 | if not cond then 10 | cond = true 11 | elseif type(cond) == 'string' then 12 | cond = stead.eval('return '..cond); 13 | end 14 | v.cond = cond; 15 | v.life = function(s) 16 | if stead.call_bool(s, 'cond') then 17 | s:off() 18 | local r,v = stead.call(s, 'act') 19 | if r then 20 | return r, true 21 | end 22 | return r,v 23 | end 24 | end 25 | 26 | v.state = function(s) 27 | return s._state; 28 | end 29 | 30 | v.on = function(s, p) 31 | s._state = true 32 | stead.lifeon(s, p) 33 | return s 34 | end 35 | 36 | v.off = function(s) 37 | s._state = false 38 | stead.lifeoff(s) 39 | return s 40 | end 41 | 42 | return obj(v) 43 | end 44 | -------------------------------------------------------------------------------- /doc/modules3-ru.tex: -------------------------------------------------------------------------------- 1 | \documentclass[12pt,]{book} 2 | \usepackage{cmap} 3 | \usepackage{tocloft} 4 | \usepackage[T2A]{fontenc} 5 | \usepackage[english,russian]{babel} 6 | \usepackage{indentfirst} 7 | % \usepackage[russian]{datetime} 8 | \usepackage{upquote} 9 | 10 | \usepackage{ifxetex,ifluatex} 11 | \usepackage{fixltx2e} % provides \textsubscript 12 | 13 | \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex 14 | % \usepackage[utf8]{inputenc} 15 | \else % if luatex or xelatex 16 | \usepackage{fontspec} 17 | \ifxetex 18 | \usepackage{xltxtra,xunicode} 19 | \fi 20 | \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} 21 | \newcommand{\euro}{€} 22 | \setmainfont{Verdana} 23 | \setsansfont{Verdana} 24 | \setmonofont{Liberation Mono} 25 | \fi 26 | 27 | \ifxetex 28 | \usepackage[setpagesize=false, % page size defined by xetex 29 | unicode=false, % unicode breaks when used with xetex 30 | xetex]{hyperref} 31 | \else 32 | \usepackage[unicode=true]{hyperref} 33 | \fi 34 | \hypersetup{breaklinks=true, 35 | bookmarks=true, 36 | pdfauthor={}, 37 | pdftitle={STEAD3}, 38 | colorlinks=true, 39 | urlcolor=blue, 40 | linkcolor=magenta, 41 | pdfborder={0 0 0}} 42 | 43 | \setcounter{tocdepth}{3} 44 | \setcounter{secnumdepth}{3} 45 | 46 | \title{STEAD3: Программирование модулей} 47 | \author{Петр Косых} 48 | \date{\today} 49 | \sloppy 50 | \begin{document} 51 | \maketitle 52 | { 53 | \hypersetup{linkcolor=black} 54 | \renewcommand{\contentsname}{Оглавление} 55 | \tableofcontents 56 | \clearpage 57 | } 58 | \input{modules3-manual-ru.tex} 59 | \end{document} 60 | -------------------------------------------------------------------------------- /doc/stead3-en.tex: -------------------------------------------------------------------------------- 1 | \documentclass[12pt,]{book} 2 | \usepackage{cmap} 3 | \usepackage{tocloft} 4 | \usepackage[T2A]{fontenc} 5 | % \usepackage[english,russian]{babel} 6 | \usepackage{indentfirst} 7 | % \usepackage[russian]{datetime} 8 | \usepackage{upquote} 9 | 10 | \usepackage{ifxetex,ifluatex} 11 | \usepackage{fixltx2e} % provides \textsubscript 12 | 13 | \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex 14 | % \usepackage[utf8]{inputenc} 15 | \else % if luatex or xelatex 16 | \usepackage{fontspec} 17 | \ifxetex 18 | \usepackage{xltxtra,xunicode} 19 | \fi 20 | \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} 21 | \newcommand{\euro}{€} 22 | \setmainfont{Verdana} 23 | \setsansfont{Verdana} 24 | \setmonofont{Liberation Mono} 25 | \fi 26 | 27 | \ifxetex 28 | \usepackage[setpagesize=false, % page size defined by xetex 29 | unicode=false, % unicode breaks when used with xetex 30 | xetex]{hyperref} 31 | \else 32 | \usepackage[unicode=true]{hyperref} 33 | \fi 34 | \hypersetup{breaklinks=true, 35 | bookmarks=true, 36 | pdfauthor={}, 37 | pdftitle={STEAD3}, 38 | colorlinks=true, 39 | urlcolor=blue, 40 | linkcolor=magenta, 41 | pdfborder={0 0 0}} 42 | 43 | \setcounter{tocdepth}{3} 44 | \setcounter{secnumdepth}{3} 45 | 46 | \title{STEAD3} 47 | \author{Peter Kosyh} 48 | \date{\today} 49 | \sloppy 50 | \begin{document} 51 | \maketitle 52 | { 53 | \hypersetup{linkcolor=black} 54 | \renewcommand{\contentsname}{Table of contents} 55 | \tableofcontents 56 | \clearpage 57 | } 58 | \input{stead3-manual-en.tex} 59 | \end{document} 60 | -------------------------------------------------------------------------------- /doc/stead3-ru.tex: -------------------------------------------------------------------------------- 1 | \documentclass[12pt,]{book} 2 | \usepackage{cmap} 3 | \usepackage{tocloft} 4 | \usepackage[T2A]{fontenc} 5 | \usepackage[english,russian]{babel} 6 | \usepackage{indentfirst} 7 | % \usepackage[russian]{datetime} 8 | \usepackage{upquote} 9 | 10 | \usepackage{ifxetex,ifluatex} 11 | \usepackage{fixltx2e} % provides \textsubscript 12 | 13 | \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex 14 | % \usepackage[utf8]{inputenc} 15 | \else % if luatex or xelatex 16 | \usepackage{fontspec} 17 | \ifxetex 18 | \usepackage{xltxtra,xunicode} 19 | \fi 20 | \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} 21 | \newcommand{\euro}{€} 22 | \setmainfont{Verdana} 23 | \setsansfont{Verdana} 24 | \setmonofont{Liberation Mono} 25 | \fi 26 | 27 | \ifxetex 28 | \usepackage[setpagesize=false, % page size defined by xetex 29 | unicode=false, % unicode breaks when used with xetex 30 | xetex]{hyperref} 31 | \else 32 | \usepackage[unicode=true]{hyperref} 33 | \fi 34 | \hypersetup{breaklinks=true, 35 | bookmarks=true, 36 | pdfauthor={}, 37 | pdftitle={STEAD3}, 38 | colorlinks=true, 39 | urlcolor=blue, 40 | linkcolor=magenta, 41 | pdfborder={0 0 0}} 42 | 43 | \setcounter{tocdepth}{3} 44 | \setcounter{secnumdepth}{3} 45 | 46 | \title{STEAD3} 47 | \author{Петр Косых} 48 | \date{\today} 49 | \sloppy 50 | \begin{document} 51 | \maketitle 52 | { 53 | \hypersetup{linkcolor=black} 54 | \renewcommand{\contentsname}{Оглавление} 55 | \tableofcontents 56 | \clearpage 57 | } 58 | \input{stead3-manual-ru.tex} 59 | \end{document} 60 | -------------------------------------------------------------------------------- /games/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(GAMES tutorial) 2 | 3 | IF(SYSTEMWIDE) 4 | FOREACH(GAME ${GAMES}) 5 | INSTALL(DIRECTORY ${GAME} DESTINATION ${GAMESDIR} PATTERN ".svn" EXCLUDE) 6 | ENDFOREACH(GAME) 7 | ELSEIF(STANDALONE) 8 | FOREACH(GAME ${GAMES}) 9 | INSTALL(DIRECTORY ${GAME} DESTINATION ${STANDALONEDIR}/games PATTERN ".svn" EXCLUDE) 10 | ENDFOREACH(GAME) 11 | ENDIF(SYSTEMWIDE) 12 | -------------------------------------------------------------------------------- /games/Makefile: -------------------------------------------------------------------------------- 1 | include ../Rules.make 2 | include ../config.make 3 | 4 | all: 5 | install: 6 | $(INSTALLD) $(DESTDIR)$(GAMESPATH) 7 | for f in *; do \ 8 | echo $$f;\ 9 | if [ ! -d $$f ]; then continue; fi;\ 10 | $(INSTALLD) $(DESTDIR)$(GAMESPATH)/$$f; \ 11 | tar --exclude=".svn" -cf - -C $$f . | tar -xpf - -C $(DESTDIR)$(GAMESPATH)/$$f;\ 12 | done 13 | 14 | uninstall: 15 | $(RM) -rf $(DESTDIR)$(GAMESPATH) 16 | 17 | clean: 18 | -------------------------------------------------------------------------------- /games/tutorial/br.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/br.png -------------------------------------------------------------------------------- /games/tutorial/de.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/de.png -------------------------------------------------------------------------------- /games/tutorial/es.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/es.png -------------------------------------------------------------------------------- /games/tutorial/fr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/fr.png -------------------------------------------------------------------------------- /games/tutorial/gb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/gb.png -------------------------------------------------------------------------------- /games/tutorial/instead.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/instead.ogg -------------------------------------------------------------------------------- /games/tutorial/instead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/instead.png -------------------------------------------------------------------------------- /games/tutorial/it.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/it.png -------------------------------------------------------------------------------- /games/tutorial/main-de.lua: -------------------------------------------------------------------------------- 1 | LANG='de' 2 | include 'tutorial' 3 | fmt.quotes = false 4 | -------------------------------------------------------------------------------- /games/tutorial/main-en.lua: -------------------------------------------------------------------------------- 1 | LANG='en' 2 | include 'tutorial' 3 | fmt.quotes = false 4 | -------------------------------------------------------------------------------- /games/tutorial/main-es.lua: -------------------------------------------------------------------------------- 1 | LANG='es' 2 | include 'tutorial' 3 | fmt.quotes = false 4 | -------------------------------------------------------------------------------- /games/tutorial/main-fr.lua: -------------------------------------------------------------------------------- 1 | LANG='fr' 2 | include 'tutorial' 3 | fmt.quotes = false 4 | -------------------------------------------------------------------------------- /games/tutorial/main-it.lua: -------------------------------------------------------------------------------- 1 | LANG='it' 2 | include 'tutorial' 3 | fmt.quotes = false 4 | -------------------------------------------------------------------------------- /games/tutorial/main-nl.lua: -------------------------------------------------------------------------------- 1 | LANG='nl' 2 | include 'tutorial' 3 | fmt.quotes = false 4 | -------------------------------------------------------------------------------- /games/tutorial/main-pt.lua: -------------------------------------------------------------------------------- 1 | LANG='pt' 2 | include 'tutorial' 3 | fmt.quotes = false 4 | -------------------------------------------------------------------------------- /games/tutorial/main-ru.lua: -------------------------------------------------------------------------------- 1 | LANG='ru' 2 | include 'tutorial' 3 | fmt.para = true 4 | -------------------------------------------------------------------------------- /games/tutorial/main-uk.lua: -------------------------------------------------------------------------------- 1 | LANG='uk' 2 | include 'tutorial' 3 | fmt.para = true 4 | -------------------------------------------------------------------------------- /games/tutorial/main3.lua: -------------------------------------------------------------------------------- 1 | -- $Name:Tutorial$ 2 | -- $Name(ru):Обучение$ 3 | -- $Name(uk):Навчання$ 4 | -- $Name(de):Einführung$ 5 | -- $Name(es):Tutorial$ 6 | -- $Name(fr):Tutoriel$ 7 | -- $Name(it):Tutorial$ 8 | -- $Name(pt):Tutorial$ 9 | -- $Name(nl):Snelstart Training$ 10 | require 'fmt' 11 | 12 | local tut_lang = { 13 | ru = 'Язык', 14 | en = 'Language', 15 | ua = 'Мова', 16 | it = 'Lingua', 17 | es = 'Idioma', 18 | pt = 'Linguagem', 19 | fr = 'Langue', 20 | de = 'Sprache', 21 | nl = 'Taal', 22 | } 23 | 24 | local tut_title = { 25 | ru = 'Обучение', 26 | en = 'Tutorial', 27 | ua = 'Навчання', 28 | it = 'Tutorial', 29 | es = 'Tutorial', 30 | pt = 'Tutorial', 31 | fr = 'Tutoriel', 32 | de = 'Einführung', 33 | nl = 'Snelstart Training', 34 | } 35 | 36 | if not LANG or not tut_lang[LANG] then 37 | LANG = "en" 38 | end 39 | 40 | tut_lang = tut_lang[LANG] 41 | tut_title = tut_title[LANG] 42 | 43 | xact.load = function(w) 44 | gamefile('main-'..w..'.lua', true) 45 | end 46 | 47 | room { 48 | nam = 'main'; 49 | title = tut_title; 50 | pic = 'instead.png'; 51 | decor = fmt.c ( 52 | fmt.b(tut_lang)..'^^'.. 53 | [[{$fmt img|gb.png} {@ load en|English}^ 54 | {$fmt img|ru.png} {@ load ru|Русский}^ 55 | {$fmt img|uk.png} {@ load uk|Українська}^ 56 | {$fmt img|es.png} {@ load es|Español}^ 57 | {$fmt img|br.png} {@ load pt|Português}^ 58 | {$fmt img|it.png} {@ load it|Italiano}^ 59 | {$fmt img|fr.png} {@ load fr|Français}^ 60 | {$fmt img|de.png} {@ load de|Deutsch}^ 61 | {$fmt img|nl.png} {@ load nl|Nederlands}]] 62 | ); 63 | } 64 | -------------------------------------------------------------------------------- /games/tutorial/nl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/nl.png -------------------------------------------------------------------------------- /games/tutorial/ru.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/ru.png -------------------------------------------------------------------------------- /games/tutorial/uk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/games/tutorial/uk.png -------------------------------------------------------------------------------- /icon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(ICON_FILES 2 | sdl_instead.png 3 | sdl_instead.ico 4 | sdl_instead.svg 5 | ) 6 | 7 | IF(WIN32) 8 | SET(PLATFORM_ICON_FILE sdl_instead_1x32.png) 9 | ELSE(WIN32) 10 | SET(PLATFORM_ICON_FILE sdl_instead_1.png) 11 | ENDIF(WIN32) 12 | 13 | IF(SYSTEMWIDE) 14 | INSTALL(FILES ${ICON_FILES} DESTINATION ${ICONDIR}) 15 | INSTALL(FILES ${PLATFORM_ICON_FILE} DESTINATION ${ICONDIR} RENAME sdl_instead_1.png) 16 | ELSEIF(STANDALONE) 17 | INSTALL(FILES ${ICON_FILES} DESTINATION ${STANDALONEDIR}/icon) 18 | INSTALL(FILES ${PLATFORM_ICON_FILE} DESTINATION ${STANDALONEDIR}/icon RENAME sdl_instead_1.png) 19 | ENDIF(SYSTEMWIDE) 20 | -------------------------------------------------------------------------------- /icon/Makefile: -------------------------------------------------------------------------------- 1 | include ../Rules.make 2 | include ../config.make 3 | 4 | clean: 5 | all: 6 | install: 7 | $(INSTALLD) $(DESTDIR)$(ICONPATH) 8 | $(INSTALL) sdl_instead.png $(DESTDIR)$(ICONPATH) 9 | ifeq ($(WINDOWS), yes) 10 | $(INSTALL) sdl_instead_1x32.png $(DESTDIR)$(ICONPATH)/sdl_instead_1.png 11 | else 12 | $(INSTALL) sdl_instead_1.png $(DESTDIR)$(ICONPATH) 13 | endif 14 | $(INSTALL) sdl_instead.ico $(DESTDIR)$(ICONPATH) 15 | 16 | uninstall: 17 | $(RM) $(DESTDIR)$(ICONPATH)/sdl_instead.png 18 | $(RM) $(DESTDIR)$(ICONPATH)/sdl_instead_1.png 19 | $(RM) $(DESTDIR)$(ICONPATH)/sdl_instead.ico 20 | -------------------------------------------------------------------------------- /icon/book16x16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/icon/book16x16.ico -------------------------------------------------------------------------------- /icon/sdl_instead.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/icon/sdl_instead.ico -------------------------------------------------------------------------------- /icon/sdl_instead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/icon/sdl_instead.png -------------------------------------------------------------------------------- /icon/sdl_instead_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/icon/sdl_instead_1.png -------------------------------------------------------------------------------- /icon/sdl_instead_1x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/icon/sdl_instead_1x32.png -------------------------------------------------------------------------------- /lang/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | IF(SYSTEMWIDE) 2 | FILE(GLOB FILES "*.ini") 3 | INSTALL(FILES ${FILES} DESTINATION ${LANGDIR}) 4 | ELSEIF(STANDALONE) 5 | FILE(GLOB FILES "*.ini") 6 | INSTALL(FILES ${FILES} DESTINATION ${STANDALONEDIR}/lang) 7 | ENDIF(SYSTEMWIDE) 8 | -------------------------------------------------------------------------------- /lang/Makefile: -------------------------------------------------------------------------------- 1 | include ../Rules.make 2 | include ../config.make 3 | 4 | clean: 5 | all: 6 | install: 7 | $(INSTALLD) $(DESTDIR)$(LANGPATH) 8 | for f in *.ini; do \ 9 | $(INSTALL) $$f $(DESTDIR)$(LANGPATH)/$$f;\ 10 | done 11 | 12 | uninstall: 13 | $(RM) -rf $(DESTDIR)$(LANGPATH) 14 | 15 | -------------------------------------------------------------------------------- /lang/cs.ini: -------------------------------------------------------------------------------- 1 | ;$Name:Česky$ 2 | UNKNOWN_ERROR = Neznámá chyba. 3 | ERROR_MENU = Chyba při nahrávání hry:\n\ 4 | '%s'\n\ 5 | \n\ 6 | Ok 7 | 8 | WARNING_MENU = Chyba při nahrávání hry:\n\ 9 | '%s'\n\ 10 | \n\ 11 | Ok 12 | 13 | SAVE_SLOT_EMPTY = prázdný 14 | SELECT_LOAD_MENU = Nahraj hru\n\n 15 | AUTOSAVE_SLOT = Autosave 16 | BROKEN_SLOT = rozbitý 17 | SELECT_SAVE_MENU = Ulož hru\n\n 18 | 19 | MAIN_MENU = \ 20 | Pokračuj ve hře\n\ 21 | Vyber hru\n\ 22 | Vyber vzhled\n\ 23 | Restartuj hru\n\ 24 | Nahraj hru\n\ 25 | Ulož hru\n\ 26 | Autoři\n\ 27 | Nastavení\n\ 28 | Konec 29 | 30 | ABOUT_MENU = \ 31 | INSTEAD - %s\n\ 32 | \n\ 33 | Naprogramoval Peter Kosyh, 2009-2023\n\ 34 | \n\ 35 | Web:\n\ 36 | https://instead-hub.github.io\n\ 37 | \n\ 38 | Zpět 39 | 40 | BACK_MENU = Zpět 41 | ON = On 42 | OFF = Off 43 | 44 | SELECT_GAME_MENU = Výběr hry\n\n 45 | SELECT_THEME_MENU = Výběr vzhledu\n\n 46 | 47 | KBD_MODE_LINKS = Links 48 | KBD_MODE_SMART = Smart 49 | KBD_MODE_SCROLL = Scroll 50 | 51 | FROM_THEME = Vzhled 52 | 53 | SETTINGS_SND_MENU = \ 54 | [Grafika][Zvuk][Ostatní]\n\ 55 | \n\ 56 | Hlasitost: <<< %d%% >>>\n\ 57 | \n\ 58 | Kvalita: << %dHz >>\n\ 59 | \n\ 60 | Hudba: %s\n\ 61 | \n\ 62 | Zvuk klikání: %s\n\ 63 | \n\ 64 | Použij 65 | 66 | SETTINGS_GFX_MENU = \ 67 | [Grafika][Zvuk][Ostatní]\n\ 68 | \n\ 69 | Rezlišení: <<%s>>\n\ 70 | Celá obrazovka: %s / HQ: %s\n\ 71 | Zvětšení písma: <<%d%%>>\n\ 72 | Zarovnání textu: <<%s>>\n\ 73 | Zvýraznění odkazů: %s\n\ 74 | Fading effect: %s\n\ 75 | Vzhledy dle hry: %s\n\ 76 | \n\ 77 | Použij 78 | 79 | SETTINGS_OTH_MENU = \ 80 | [Grafika][Zvuk][Ostatní]\n\ 81 | \n\ 82 | Scrolling mode: %s\n\ 83 | Mouse filter: %s\n\ 84 | Keyboard mode: %s\n\ 85 | \n\ 86 | Jazyk: <<%s>>\n\ 87 | \n\ 88 | Аutosave: %s\n\ 89 | \n\ 90 | Použij 91 | 92 | OWN_THEME_MENU = \ 93 | Warning!!!\n\ 94 | \n\ 95 | Current game has a custom theme.\n\ 96 | Changes will be ignored.\n\ 97 | \n\ 98 | You can disable custom themes\n\ 99 | in settings menu.\n\ 100 | \n\ 101 | Ok 102 | 103 | CUSTOM_THEME_MENU = \ 104 | Warning!!!\n\ 105 | \n\ 106 | This game has a custom theme, but custom themes are disabled. \ 107 | The game may look differently from the author's design.\n\ 108 | \n\ 109 | You can enable custom theme support in settings menu.\n\ 110 | \n\ 111 | Ok 112 | 113 | QUIT_MENU = \ 114 | Opravdu skončit?\n\ 115 | \n\ 116 | Ano | Ne 117 | 118 | SAVED_MENU = \ 119 | Hra uložena.\n\ 120 | \n\ 121 | Ok 122 | 123 | NOGAMES_MENU = \ 124 | Nenalezena žádná hra! \n\ 125 | Prosím, vložte hry do složky \n'%s' 126 | 127 | NOTHEMES_MENU = \ 128 | Nenalezen žádný vzhled!\n\ 129 | Prosím, vložte vzhled do složky:\n'%s' 130 | 131 | CANCEL_MENU = Storno 132 | 133 | DISABLED_SAVE_MENU = \ 134 | Hra zakázala ukládání.\n 135 | 136 | BROWSE_MENU = \ 137 | [...] 138 | 139 | REMOVE_MENU = \ 140 | Odstranit hru?\n\ 141 | %s\n\ 142 | \n\ 143 | Ano | Ne 144 | 145 | WAIT_MENU = \ 146 | Čekejte... 147 | -------------------------------------------------------------------------------- /lang/en.ini: -------------------------------------------------------------------------------- 1 | ;$Name:English$ 2 | UNKNOWN_ERROR = Unknown error. 3 | ERROR_MENU = Error while loading game:\n\ 4 | '%s'\n\ 5 | \n\ 6 | Ok 7 | 8 | WARNING_MENU = Error while processing game:\n\ 9 | '%s'\n\ 10 | \n\ 11 | Ok 12 | 13 | SAVE_SLOT_EMPTY = empty 14 | SELECT_LOAD_MENU = Load game\n\n 15 | AUTOSAVE_SLOT = Autosave 16 | BROKEN_SLOT = error 17 | SELECT_SAVE_MENU = Save game\n\n 18 | 19 | MAIN_MENU = \ 20 | Resume game\n\ 21 | Select game\n\ 22 | Select theme\n\ 23 | Restart game\n\ 24 | Load game\n\ 25 | Save game\n\ 26 | About\n\ 27 | Settings\n\ 28 | Quit 29 | 30 | ABOUT_MENU = \ 31 | INSTEAD - %s\n\ 32 | \n\ 33 | Written by Peter Kosyh, 2009-2023\n\ 34 | \n\ 35 | Homepage:\n\ 36 | https://instead-hub.github.io\n\ 37 | \n\ 38 | Back 39 | 40 | BACK_MENU = Back 41 | ON = On 42 | OFF = Off 43 | 44 | SELECT_GAME_MENU = Select game to play\n\n 45 | SELECT_THEME_MENU = Select theme\n\n 46 | 47 | KBD_MODE_LINKS = Links 48 | KBD_MODE_SMART = Smart 49 | KBD_MODE_SCROLL = Scroll 50 | 51 | FROM_THEME = Theme 52 | 53 | SETTINGS_SND_MENU = \ 54 | [Graphics][Sound][Other]\n\ 55 | \n\ 56 | Volume: <<< %d%% >>>\n\ 57 | \n\ 58 | Quality: << %dHz >>\n\ 59 | \n\ 60 | Music: %s\n\ 61 | \n\ 62 | Click sound: %s\n\ 63 | \n\ 64 | Apply 65 | 66 | SETTINGS_GFX_MENU = \ 67 | [Graphics][Sound][Other]\n\ 68 | \n\ 69 | Resolution: <<%s>>\n\ 70 | Full screen: %s / HQ: %s\n\ 71 | Font scaling: <<%d%%>>\n\ 72 | Justify text: <<%s>>\n\ 73 | Links highlighting: %s\n\ 74 | Fading effect: %s\n\ 75 | Custom game themes: %s\n\ 76 | \n\ 77 | Apply 78 | 79 | SETTINGS_OTH_MENU = \ 80 | [Graphics][Sound][Other]\n\ 81 | \n\ 82 | Scrolling mode: %s\n\ 83 | Mouse filter: %s\n\ 84 | Keyboard mode: %s\n\ 85 | \n\ 86 | Language: <<%s>>\n\ 87 | \n\ 88 | Аutosave: %s\n\ 89 | \n\ 90 | Apply 91 | 92 | OWN_THEME_MENU = \ 93 | Warning!!!\n\ 94 | \n\ 95 | Current game has a custom theme.\n\ 96 | Changes will be ignored.\n\ 97 | \n\ 98 | You can disable custom themes\n\ 99 | in settings menu.\n\ 100 | \n\ 101 | Ok 102 | 103 | CUSTOM_THEME_MENU = \ 104 | Warning!!!\n\ 105 | \n\ 106 | This game has a custom theme, but custom themes are disabled. \ 107 | The game may look differently from the author's design.\n\ 108 | \n\ 109 | You can enable custom theme support in settings menu.\n\ 110 | \n\ 111 | Ok 112 | 113 | QUIT_MENU = \ 114 | Really quit?\n\ 115 | \n\ 116 | Yes | No 117 | 118 | SAVED_MENU = \ 119 | Current Game saved!\n\ 120 | \n\ 121 | Ok 122 | 123 | NOGAMES_MENU = \ 124 | No games found. \n\ 125 | Please, put any game in the directory \n'%s' 126 | 127 | NOTHEMES_MENU = \ 128 | No themes found.\n\ 129 | Please, put any theme in the directory:\n'%s' 130 | 131 | CANCEL_MENU = Cancel 132 | 133 | DISABLED_SAVE_MENU = \ 134 | Saving is disabled by game.\n 135 | 136 | BROWSE_MENU = \ 137 | [...] 138 | 139 | REMOVE_MENU = \ 140 | Remove the game?\n\ 141 | %s\n\ 142 | \n\ 143 | Yes | No 144 | 145 | WAIT_MENU = \ 146 | Please wait... 147 | -------------------------------------------------------------------------------- /lang/es.ini: -------------------------------------------------------------------------------- 1 | ;$Name:Español$ 2 | UNKNOWN_ERROR = Error desconocido. 3 | ERROR_MENU = Error al cargar el juego:\n\ 4 | '%s'\n\ 5 | \n\ 6 | Ok 7 | 8 | WARNING_MENU = Error al procesar el juego:\n\ 9 | '%s'\n\ 10 | \n\ 11 | Ok 12 | 13 | SAVE_SLOT_EMPTY = vacío 14 | SELECT_LOAD_MENU = Cargar juego\n\n 15 | AUTOSAVE_SLOT = Autoguardar 16 | BROKEN_SLOT = error 17 | SELECT_SAVE_MENU = Guardar juego\n\n 18 | 19 | MAIN_MENU = \ 20 | Continuar juego\n\ 21 | Elegir juego\n\ 22 | Elegir tema\n\ 23 | Reiniciar juego\n\ 24 | Cargar juego\n\ 25 | Guardar juego\n\ 26 | Acerca de\n\ 27 | Opciones\n\ 28 | Salir 29 | 30 | ABOUT_MENU = \ 31 | INSTEAD - %s\n\ 32 | \n\ 33 | Escrito por Peter Kosyh, 2009-2023\n\ 34 | \n\ 35 | Web:\n\ 36 | https://instead-hub.github.io\n\ 37 | \n\ 38 | Atrás 39 | 40 | BACK_MENU = Atrás 41 | ON = On 42 | OFF = Off 43 | 44 | SELECT_GAME_MENU = Elegir juego\n\n 45 | SELECT_THEME_MENU = Elegir tema\n\n 46 | 47 | KBD_MODE_LINKS = Links 48 | KBD_MODE_SMART = Smart 49 | KBD_MODE_SCROLL = Scroll 50 | 51 | FROM_THEME = Tema 52 | 53 | SETTINGS_SND_MENU = \ 54 | [Gráficos][Sonido][Otros]\n\ 55 | \n\ 56 | Volumen: <<< %d%% >>>\n\ 57 | \n\ 58 | Calidad: << %dHz >>\n\ 59 | \n\ 60 | Música: %s\n\ 61 | \n\ 62 | Sonido Click: %s\n\ 63 | \n\ 64 | Aceptar 65 | 66 | SETTINGS_GFX_MENU = \ 67 | [Gráficos][Sonido][Otros]\n\ 68 | \n\ 69 | Resolución: <<%s>>\n\ 70 | Pantalla Completa: %s / HQ: %s\n\ 71 | Escala de Fuente: <<%d%%>>\n\ 72 | Justificar el texto: <<%s>>\n\ 73 | Resaltar Links: %s\n\ 74 | Efecto de atenuación: %s\n\ 75 | Temas específicos del juego: %s\n\ 76 | \n\ 77 | Aceptar 78 | 79 | SETTINGS_OTH_MENU = \ 80 | [Gráficos][Sonido][Otros]\n\ 81 | \n\ 82 | Modo Scrolling: %s\n\ 83 | Filtrar Mouse: %s\n\ 84 | Modo Teclado: %s\n\ 85 | \n\ 86 | Idioma: <<%s>>\n\ 87 | \n\ 88 | AutoGuardar: %s\n\ 89 | \n\ 90 | Aceptar 91 | 92 | OWN_THEME_MENU = \ 93 | Atención!!\n\ 94 | \n\ 95 | El juego actual tienen un tema específico.\n\ 96 | Los cambios se descartarán\n\ 97 | \n\ 98 | No puedes deshabilitar los temas específicos\n\ 99 | en el menú de opciones.\n\ 100 | \n\ 101 | Ok 102 | 103 | CUSTOM_THEME_MENU = \ 104 | Atención!!\n\ 105 | \n\ 106 | Este juego requiere un tema específico, pero los temas específicos están deshabilitados. \ 107 | Este juego puede no tener el aspecto original diseñado por su autor.\n\ 108 | \n\ 109 | Puedes habilitar el soporte de temas específicos desde el menú de opciones.\n\ 110 | \n\ 111 | Ok 112 | 113 | QUIT_MENU = \ 114 | ¿Realmente quieres salir?\n\ 115 | \n\ 116 | Sí | No 117 | 118 | SAVED_MENU = \ 119 | Juego guardado!\n\ 120 | \n\ 121 | Ok 122 | 123 | NOGAMES_MENU = \ 124 | No se encontraron juegos. \n\ 125 | Por favor, copia algún juego en la carpeta \n'%s' 126 | 127 | NOTHEMES_MENU = \ 128 | No existen temas.\n\ 129 | Por favor, copia algún tema en la carpeta :\n'%s' 130 | 131 | CANCEL_MENU = Cancelar 132 | 133 | DISABLED_SAVE_MENU = \ 134 | Guardar está deshabilitado desde el juego.\n 135 | 136 | BROWSE_MENU = \ 137 | [...] 138 | 139 | REMOVE_MENU = \ 140 | ¿Quitar el juego?\n\ 141 | %s\n\ 142 | \n\ 143 | Yes | No 144 | 145 | WAIT_MENU = \ 146 | Espere por favor... 147 | -------------------------------------------------------------------------------- /lang/pt.ini: -------------------------------------------------------------------------------- 1 | ;$Name:Português$ 2 | UNKNOWN_ERROR = Erro desconhecido. 3 | ERROR_MENU = Erro ao carregar o jogo:\n\ 4 | '%s'\n\ 5 | \n\ 6 | Ok 7 | 8 | WARNING_MENU = Erro ao processar o jogo:\n\ 9 | '%s'\n\ 10 | \n\ 11 | Ok 12 | 13 | SAVE_SLOT_EMPTY = vazio 14 | SELECT_LOAD_MENU = Carregar jogo\n\n 15 | AUTOSAVE_SLOT = Auto-salvar 16 | BROKEN_SLOT = erro 17 | SELECT_SAVE_MENU = Salvar jogo\n\n 18 | 19 | MAIN_MENU = \ 20 | Continuar jogo\n\ 21 | Escolher jogo\n\ 22 | Escolher tema\n\ 23 | Reiniciar jogo\n\ 24 | Carregar jogo\n\ 25 | Salvar jogo\n\ 26 | Sobre\n\ 27 | Opções\n\ 28 | Sair 29 | 30 | ABOUT_MENU = \ 31 | INSTEAD - %s\n\ 32 | \n\ 33 | Escrito por Peter Kosyh, 2009-2023\n\ 34 | \n\ 35 | Web:\n\ 36 | https://instead-hub.github.io\n\ 37 | \n\ 38 | Voltar 39 | 40 | BACK_MENU = Voltar 41 | ON = On 42 | OFF = Off 43 | 44 | SELECT_GAME_MENU = Escolher jogo\n\n 45 | SELECT_THEME_MENU = Escolher tema\n\n 46 | 47 | KBD_MODE_LINKS = Links 48 | KBD_MODE_SMART = Smart 49 | KBD_MODE_SCROLL = Scroll 50 | 51 | FROM_THEME = Theme 52 | 53 | SETTINGS_SND_MENU = \ 54 | [Gráficos][Som][Outros]\n\ 55 | \n\ 56 | Volume: <<< %d%% >>>\n\ 57 | \n\ 58 | Qualidade: << %dHz >>\n\ 59 | \n\ 60 | Música: %s\n\ 61 | \n\ 62 | Som de click: %s\n\ 63 | \n\ 64 | Aplicar 65 | 66 | SETTINGS_GFX_MENU = \ 67 | [Gráficos][Som][Outros]\n\ 68 | \n\ 69 | Resolução: <<%s>>\n\ 70 | Tela cheia: %s / HQ: %s\n\ 71 | Fonte: <<%d%%>>\n\ 72 | Justificar: <<%s>>\n\ 73 | Realçar links: %s\n\ 74 | Atenuação: %s\n\ 75 | Temas do jogo: %s\n\ 76 | \n\ 77 | Aplicar 78 | 79 | SETTINGS_OTH_MENU = \ 80 | [Gráficos][Som][Outros]\n\ 81 | \n\ 82 | Modo de rolagem: %s\n\ 83 | Filtro de Mouse: %s\n\ 84 | Modo de teclado: %s\n\ 85 | \n\ 86 | Língua: <<%s>>\n\ 87 | \n\ 88 | Аuto-salvar: %s\n\ 89 | \n\ 90 | Aplicar 91 | 92 | OWN_THEME_MENU = \ 93 | Atenção!!!\n\ 94 | \n\ 95 | O jogo atual tem um tema personalizado.\n\ 96 | Alterações serão ignoradas.\n\ 97 | \n\ 98 | Você pode desabilitar temas personalizados\n\ 99 | no menu de opções.\n\ 100 | \n\ 101 | Ok 102 | 103 | CUSTOM_THEME_MENU = \ 104 | Atenção!!!\n\ 105 | \n\ 106 | Há um tema para este jogo, mas temas personalizados estão desabilitados. \ 107 | O jogo pode parecer diferente do projeto do autor.\n\ 108 | \n\ 109 | Você pode habilitar suporte a temas personalizados no menu de opções.\n\ 110 | \n\ 111 | Ok 112 | 113 | QUIT_MENU = \ 114 | Sair mesmo?\n\ 115 | \n\ 116 | Sim | Não 117 | 118 | SAVED_MENU = \ 119 | Jogo salvo!\n\ 120 | \n\ 121 | Ok 122 | 123 | NOGAMES_MENU = \ 124 | Nenhum jogo encontrado. \n\ 125 | Favor colocar um jogo na pasta \n'%s' 126 | 127 | NOTHEMES_MENU = \ 128 | Nenhum tema encontrado.\n\ 129 | Favor colocar um tema na pasta:\n'%s' 130 | 131 | CANCEL_MENU = Cancelar 132 | 133 | DISABLED_SAVE_MENU = \ 134 | Salvar desabilitado.\n 135 | 136 | BROWSE_MENU = \ 137 | [...] 138 | 139 | REMOVE_MENU = \ 140 | Remover o jogo?\n\ 141 | %s\n\ 142 | \n\ 143 | Sim | Não 144 | 145 | WAIT_MENU = \ 146 | Favor aguardar... 147 | -------------------------------------------------------------------------------- /sdl-instead: -------------------------------------------------------------------------------- 1 | src/sdl-instead -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | include ../Rules.make 2 | include ../config.make 3 | 4 | CFLAGS += $(SDL_CFLAGS) $(LUA_CFLAGS) $(ZLIB_CFLAGS) $(EXTRA_CFLAGS) -D_USE_SDL -DLANG_PATH=\"${LANGPATH}/\" -DSTEAD_PATH=\"${STEADPATH}/\" -DGAMES_PATH=\"${GAMESPATH}/\" -DTHEMES_PATH=\"${THEMESPATH}/\" -DVERSION=\"$(VERSION)\" -DICON_PATH=\"${ICONPATH}/\" 5 | 6 | LDFLAGS += $(SDL_LFLAGS) $(LUA_LFLAGS) $(ZLIB_LFLAGS) $(EXTRA_LDFLAGS) 7 | 8 | INSTEAD_SRC := instead/instead.c instead/util.c instead/list.c instead/cache.c instead/idf.c instead/tinymt32.c instead/lfs.c 9 | INSTEAD_H := instead/cache.h instead/system.h instead/instead.h instead/list.h instead/util.h instead/tinymt32.h instead/idf.h 10 | 11 | SRC := graphics.c input.c game.c main.c \ 12 | instead_bits.c instead_sprites.c instead_timer.c instead_sound.c instead_paths.c noise1234.c \ 13 | sound.c SDL_rotozoom.c SDL_gfxBlitFunc.c SDL_gif.c config.c themes.c menu.c \ 14 | utils.c unzip.c ioapi.c unpack.c $(PLATFORM) $(INSTEAD_SRC) 15 | 16 | H := config.h externals.h game.h graphics.h input.h internals.h ioapi.h iowin32.h \ 17 | menu.h SDL_rotozoom.h SDL_gif.h SDL_gfxBlitFunc.h sound.h themes.h unzip.h $(INSTEAD_H) 18 | 19 | OBJ := $(patsubst %.c, %.o, $(SRC)) $(ADDOBJ) 20 | 21 | all: sdl-instead$(EXE) 22 | 23 | $(OBJ): %.o : %.c $(H) 24 | $(CC) -c $(<) $(I) $(CFLAGS) $(CPPFLAGS) -o $(@) 25 | 26 | sdl-instead$(EXE): $(OBJ) $(RESOURCES) 27 | $(CC) $(CFLAGS) $(^) $(LDFLAGS) -o $(@) 28 | 29 | install: 30 | $(INSTALLD) $(DESTDIR)$(BIN) 31 | $(INSTALLB) sdl-instead$(EXE) $(DESTDIR)$(BIN)/sdl-instead$(EXE) 32 | $(LN) sdl-instead$(EXE) $(DESTDIR)$(BIN)/instead$(EXE) 33 | 34 | uninstall: 35 | $(RM) $(DESTDIR)$(BIN)/sdl-instead$(EXE) 36 | $(RM) $(DESTDIR)$(BIN)/instead$(EXE) 37 | 38 | clean: 39 | $(RM) -f *.o instead/*.o sdl-instead$(EXE) 40 | -------------------------------------------------------------------------------- /src/SDL_gif.h: -------------------------------------------------------------------------------- 1 | #ifndef _SDL_AGIF_H 2 | #define _SDL_AGIF_H 3 | 4 | /* Code adopted from SDL2_image library, Licensed under zlib */ 5 | 6 | /* 7 | SDL_image: An example image loading library for use with SDL 8 | Copyright (C) 1997-2020 Sam Lantinga 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any damages 12 | arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, 15 | including commercial applications, and to alter it and redistribute it 16 | freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not 19 | claim that you wrote the original software. If you use this software 20 | in a product, an acknowledgment in the product documentation would be 21 | appreciated but is not required. 22 | 2. Altered source versions must be plainly marked as such, and must not be 23 | misrepresented as being the original software. 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | 27 | /* This is a GIF image file loading framework */ 28 | 29 | #include 30 | 31 | typedef struct 32 | { 33 | int w, h; 34 | int count; 35 | int loop; 36 | SDL_Surface **frames; 37 | int *delays; 38 | } Animation_t; 39 | 40 | extern DECLSPEC Animation_t *GIF_LoadAnim(const char* file); 41 | extern DECLSPEC void FreeAnimation(Animation_t *anim); 42 | 43 | #endif /* _SDL_AGIF_H */ 44 | -------------------------------------------------------------------------------- /src/SDL_rotozoom.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | SDL2_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces 4 | 5 | Copyright (C) 2001-2012 Andreas Schiffler 6 | 7 | This software is provided 'as-is', without any express or implied 8 | warranty. In no event will the authors be held liable for any damages 9 | arising from the use of this software. 10 | 11 | Permission is granted to anyone to use this software for any purpose, 12 | including commercial applications, and to alter it and redistribute it 13 | freely, subject to the following restrictions: 14 | 15 | 1. The origin of this software must not be misrepresented; you must not 16 | claim that you wrote the original software. If you use this software 17 | in a product, an acknowledgment in the product documentation would be 18 | appreciated but is not required. 19 | 20 | 2. Altered source versions must be plainly marked as such, and must not be 21 | misrepresented as being the original software. 22 | 23 | 3. This notice may not be removed or altered from any source 24 | distribution. 25 | 26 | Andreas Schiffler -- aschiffler at ferzkopp dot net 27 | 28 | */ 29 | 30 | #ifndef _SDL2_rotozoom_h 31 | #define _SDL2_rotozoom_h 32 | 33 | #include 34 | 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | #ifndef M_PI 41 | #define M_PI 3.1415926535897932384626433832795 42 | #endif 43 | 44 | #include "SDL.h" 45 | 46 | /* ---- Defines */ 47 | 48 | /*! 49 | \brief Disable anti-aliasing (no smoothing). 50 | */ 51 | #define SMOOTHING_OFF 0 52 | 53 | /*! 54 | \brief Enable anti-aliasing (smoothing). 55 | */ 56 | #define SMOOTHING_ON 1 57 | 58 | /* ---- Function Prototypes */ 59 | 60 | #ifdef _MSC_VER 61 | # if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT) 62 | # define SDL2_ROTOZOOM_SCOPE __declspec(dllexport) 63 | # else 64 | # ifdef LIBSDL2_GFX_DLL_IMPORT 65 | # define SDL2_ROTOZOOM_SCOPE __declspec(dllimport) 66 | # endif 67 | # endif 68 | #endif 69 | #ifndef SDL2_ROTOZOOM_SCOPE 70 | # define SDL2_ROTOZOOM_SCOPE extern 71 | #endif 72 | 73 | /* 74 | 75 | Rotozoom functions 76 | 77 | */ 78 | 79 | SDL2_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth); 80 | 81 | SDL2_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurfaceXY 82 | (SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth); 83 | 84 | 85 | SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, 86 | int *dstheight); 87 | 88 | SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY 89 | (int width, int height, double angle, double zoomx, double zoomy, 90 | int *dstwidth, int *dstheight); 91 | 92 | /* 93 | 94 | Zooming functions 95 | 96 | */ 97 | 98 | SDL2_ROTOZOOM_SCOPE SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth); 99 | 100 | SDL2_ROTOZOOM_SCOPE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight); 101 | 102 | /* 103 | 104 | Shrinking functions 105 | 106 | */ 107 | 108 | SDL2_ROTOZOOM_SCOPE SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory); 109 | 110 | /* 111 | 112 | Specialized rotation functions 113 | 114 | */ 115 | 116 | SDL2_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns); 117 | 118 | /* Ends C function definitions when using C++ */ 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | 123 | #endif /* _SDL2_rotozoom_h */ 124 | -------------------------------------------------------------------------------- /src/android.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef SDL_JAVA_PACKAGE_PATH 3 | #error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles" 4 | #endif 5 | #define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name 6 | #define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package) 7 | #define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH) 8 | extern void JNICALL JAVA_EXPORT_NAME(SDLActivity_nativeSave)(JNIEnv *env, jobject obj) { 9 | cfg_save(); 10 | } 11 | 12 | extern void JNICALL JAVA_EXPORT_NAME(SDLActivity_nativeStop)(JNIEnv *env, jobject obj) { 13 | game_done(0); 14 | exit(0); 15 | } 16 | -------------------------------------------------------------------------------- /src/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __CONFIG_H_INCLUDED 26 | #define __CONFIG_H_INCLUDED 27 | 28 | #define FONT_SZ(v) (SCALABLE_FONT?((v) * (1.0f + ((0.1f * opt_fsize)))):(v)) 29 | 30 | #define KBD_SMART 0 31 | #define KBD_NORMAL 1 32 | #define KBD_INVERSE 2 33 | #define KBD_MAX 3 34 | 35 | #define JUST_THEME 0 36 | #define JUST_NO 1 37 | #define JUST_YES 2 38 | #define JUST_MAX 3 39 | 40 | extern char *appdata_sw; 41 | extern int chunksize_sw; 42 | 43 | extern int opt_fading; 44 | extern int opt_fsize; 45 | extern int opt_fs; 46 | extern int opt_owntheme; 47 | extern int opt_hl; 48 | extern int opt_hz; 49 | extern int opt_vol; 50 | extern int opt_motion; 51 | extern int opt_click; 52 | extern int opt_music; 53 | extern int opt_autosave; 54 | extern int opt_filter; 55 | extern int opt_kbd; 56 | extern int opt_justify; 57 | extern int opt_vsync; 58 | extern int opt_debug; 59 | extern int opt_resizable; 60 | extern int opt_hires; 61 | 62 | extern int opt_mode[2]; 63 | extern char *opt_game; 64 | extern char *opt_theme; 65 | extern char *opt_lang; 66 | 67 | extern void cfg_init(void); 68 | 69 | extern int cfg_load(void); 70 | extern int cfg_save(void); 71 | 72 | extern int parse_mode(const char *v, void *data); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/externals.h: -------------------------------------------------------------------------------- 1 | #include "instead/system.h" 2 | #ifdef __EMSCRIPTEN__ 3 | #include "emscripten.h" 4 | #include "emscripten/html5.h" 5 | #endif 6 | -------------------------------------------------------------------------------- /src/input.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2019 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __INPUT_H__ 26 | #define __INPUT_H__ 27 | 28 | #define KEY_DOWN 1 29 | #define KEY_UP 2 30 | #define MOUSE_DOWN 3 31 | #define MOUSE_UP 4 32 | #define MOUSE_WHEEL_UP 5 33 | #define MOUSE_WHEEL_DOWN 6 34 | #define MOUSE_MOTION 7 35 | #define USER_EVENT 8 36 | #define FINGER_UP 9 37 | #define FINGER_DOWN 10 38 | #define KEY_TEXT 11 39 | 40 | #define EV_CODE_KBD -1 41 | #define EV_CODE_FINGER -2 42 | #define EV_CODE_TEXT -3 43 | #define EV_CODE_WHEEL -4 44 | 45 | #define AGAIN 2 46 | struct inp_event { 47 | int type; 48 | int code; 49 | char sym[64]; 50 | int x; 51 | int y; 52 | int count; 53 | }; 54 | 55 | int input(struct inp_event *ev, int wait); 56 | int input_init(void); 57 | void input_done(void); 58 | void input_clear(void); 59 | void input_uevents(void); 60 | void push_user_event(void (*p) (void*), void *data); 61 | int mouse_focus(void); 62 | extern int minimized(void); 63 | extern int mouse_cursor(int on); 64 | extern int finger_pos(const char *finger, int *x, int *y, float *pressure); 65 | extern int system_clipboard(const char *text, char **buf); 66 | extern int input_text(int start); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/instead/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __CACHE_H 26 | #define __CACHE_H 27 | 28 | typedef void * cache_t; 29 | typedef void (*cache_free_fn)(void *p); 30 | 31 | extern cache_t cache_init(int size, cache_free_fn); 32 | extern void cache_free(cache_t cache); 33 | extern int cache_forget(cache_t cache, void *p); 34 | extern void cache_zap(cache_t cache); 35 | extern void cache_shrink(cache_t cache); 36 | extern void *cache_get(cache_t cache, const char *name); 37 | extern void *cache_lookup(cache_t cache, const char *name); 38 | extern int cache_add(cache_t cache, const char *name, void *p); 39 | extern int cache_have(cache_t cache, void *p); 40 | extern unsigned long hash_addr(void *p); 41 | extern unsigned long hash_string(const char *str); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/instead/idf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __IDF_H_INCLUDED 26 | #define __IDF_H_INCLUDED 27 | 28 | struct _idf_t; 29 | struct _idff_t; 30 | typedef struct _idf_t *idf_t; 31 | typedef struct _idff_t *idff_t; 32 | 33 | extern idf_t idf_init(const char *path); 34 | extern void idf_shrink(idf_t idf); 35 | extern void idf_done(idf_t idf); 36 | 37 | extern int idf_create(const char *file, const char *path); 38 | extern idff_t idf_open(idf_t idf, const char *fname); 39 | extern int idf_setdir(idf_t idf, const char *path); 40 | extern char *idf_getdir(idf_t idf); 41 | 42 | extern int idf_seek(idff_t fil, int offset, int whence); 43 | extern int idf_read(idff_t fil, void *ptr, int size, int maxnum); 44 | extern int idf_close(idff_t fil); 45 | 46 | extern int idf_eof(idff_t idf); 47 | extern int idf_error(idff_t idf); 48 | extern int idf_access(idf_t idf, const char *fname); 49 | 50 | extern idff_t idf_opendir(idf_t idf, const char *dname); 51 | extern int idf_closedir(idff_t d); 52 | extern char *idf_readdir(idff_t d); 53 | 54 | extern char *idf_gets(idff_t idf, char *b, int size); 55 | extern int idf_magic(const char *fname); 56 | extern int idf_only(idf_t idf, int fl); 57 | 58 | #ifdef _USE_SDL 59 | #include 60 | extern SDL_RWops *RWFromIdf(idf_t idf, const char *fname); 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/instead/instead.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2021 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __INSTEAD_H__ 26 | #define __INSTEAD_H__ 27 | 28 | #include 29 | #include 30 | #include "idf.h" 31 | #include "list.h" 32 | 33 | #define INSTEAD_NIL 0 34 | #define INSTEAD_NUM 1 35 | #define INSTEAD_STR 2 36 | #define INSTEAD_BOOL 3 37 | 38 | #define INSTEAD_MAIN "main.lua" 39 | #define INSTEAD_MAIN3 "main3.lua" 40 | #define INSTEAD_IDF "data.idf" 41 | 42 | #ifndef STEAD_PATH 43 | #define STEAD_PATH "./stead" 44 | #endif 45 | 46 | struct instead_args { 47 | int type; 48 | const char *val; 49 | }; 50 | 51 | struct instead_ext { 52 | struct list_node list; 53 | int (*init)(void); 54 | int (*done)(void); 55 | int (*err)(void); 56 | int (*cmd)(void); 57 | }; 58 | 59 | extern int instead_init(const char *path); 60 | extern int instead_load(char **info); 61 | extern void instead_done(void); 62 | extern void instead_lock(void); 63 | extern void instead_unlock(void); 64 | extern char *instead_cmd(char *s, int *rc); 65 | extern char *instead_file_cmd(char *s, int *rc); 66 | 67 | extern int instead_function(char *s, struct instead_args *args); 68 | extern int instead_eval(char *s); 69 | extern int instead_pcall(lua_State *L, int nargs); 70 | extern int instead_clear(void); 71 | extern char *instead_retval(int n); 72 | extern int instead_bretval(int n); 73 | extern int instead_iretval(int n); 74 | extern char *instead_fromgame(const char *s); 75 | extern int instead_encode(const char *s, const char *d); 76 | extern int instead_busy(void); 77 | 78 | extern void instead_set_encoding(const char *cp); /* UTF-8 by default */ 79 | 80 | /* internal use */ 81 | extern int instead_init_lua(const char *path, int detect); 82 | extern int instead_loadscript(const char *name, int argc, char **argv, int exec); 83 | extern int instead_loadfile(const char *name); 84 | 85 | extern void instead_err_msg(const char *s); 86 | extern const char *instead_err(void); 87 | 88 | extern int instead_extension(struct instead_ext *ext); 89 | extern int instead_api_register(const luaL_Reg *api); 90 | 91 | extern idf_t instead_idf(void); 92 | extern int instead_set_lang(const char *lang); 93 | extern int instead_set_debug(int); 94 | extern int instead_set_standalone(int); 95 | /* extern int instead_set_api(const char *api); */ 96 | extern const char *instead_lua_path(const char *path); /* override STEAD_PATH */ 97 | 98 | extern const char *instead_get_api(void); 99 | 100 | extern lua_State *instead_lua(void); 101 | 102 | extern char *instead_local_stead_path(void); 103 | extern char *instead_path(void); 104 | extern char *instead_stead_path(void); 105 | extern char *instead_cwd(void); 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /src/instead/lfs.c: -------------------------------------------------------------------------------- 1 | /* From: 2 | ** LuaFileSystem 3 | ** Copyright Kepler Project 2003 (http://www.keplerproject.org/luafilesystem) 4 | ** $Id: lfs.c,v 1.61 2009/07/04 02:10:16 mascarenhas Exp $ 5 | */ 6 | #include "system.h" 7 | #include "util.h" 8 | 9 | #define DIR_METATABLE "directory metatable" 10 | typedef struct dir_data { 11 | int closed; 12 | #ifdef _WIN32 13 | intptr_t hFile; 14 | char pattern[PATH_MAX + 1]; 15 | #else 16 | DIR *dir; 17 | #endif 18 | } dir_data; 19 | 20 | /* 21 | ** Directory iterator 22 | */ 23 | static int dir_iter (lua_State *L) { 24 | #ifdef _WIN32 25 | struct _finddata_t c_file; 26 | #else 27 | struct dirent *entry; 28 | #endif 29 | dir_data *d = (dir_data *)luaL_checkudata (L, 1, DIR_METATABLE); 30 | luaL_argcheck (L, d->closed == 0, 1, "closed directory"); 31 | #ifdef _WIN32 32 | if (d->hFile == 0L) { /* first entry */ 33 | if ((d->hFile = _findfirst (d->pattern, &c_file)) == -1L) { 34 | lua_pushnil (L); 35 | lua_pushstring (L, "Error while iterating dir."); 36 | d->closed = 1; 37 | return 2; 38 | } else { 39 | lua_pushstring (L, c_file.name); 40 | return 1; 41 | } 42 | } else { /* next entry */ 43 | if (_findnext (d->hFile, &c_file) == -1L) { 44 | /* no more entries => close directory */ 45 | _findclose (d->hFile); 46 | d->closed = 1; 47 | return 0; 48 | } else { 49 | lua_pushstring (L, c_file.name); 50 | return 1; 51 | } 52 | } 53 | #else 54 | if (!d->dir) 55 | return 0; /* no directory opened */ 56 | if ((entry = readdir (d->dir)) != NULL) { 57 | lua_pushstring (L, entry->d_name); 58 | return 1; 59 | } else { 60 | /* no more entries => close directory */ 61 | closedir (d->dir); 62 | d->closed = 1; 63 | return 0; 64 | } 65 | #endif 66 | } 67 | 68 | 69 | /* 70 | ** Closes directory iterators 71 | */ 72 | static int dir_close (lua_State *L) { 73 | dir_data *d = (dir_data *)lua_touserdata (L, 1); 74 | #ifdef _WIN32 75 | if (!d->closed && d->hFile) { 76 | _findclose (d->hFile); 77 | } 78 | #else 79 | if (!d->closed && d->dir) { 80 | closedir (d->dir); 81 | } 82 | #endif 83 | d->closed = 1; 84 | return 0; 85 | } 86 | 87 | 88 | /* 89 | ** Factory of directory iterators 90 | */ 91 | int dir_iter_factory (lua_State *L) { 92 | const char *path = luaL_checkstring (L, 1); 93 | dir_data *d; 94 | lua_pushcfunction (L, dir_iter); 95 | d = (dir_data *) lua_newuserdata (L, sizeof(dir_data)); 96 | d->closed = 0; 97 | #ifdef _WIN32 98 | d->hFile = 0L; 99 | luaL_getmetatable (L, DIR_METATABLE); 100 | lua_setmetatable (L, -2); 101 | if (strlen(path) > PATH_MAX - 2) 102 | luaL_error (L, "path too long: %s", path); 103 | else 104 | sprintf (d->pattern, "%s/*", path); 105 | #else 106 | luaL_getmetatable (L, DIR_METATABLE); 107 | lua_setmetatable (L, -2); 108 | d->dir = opendir (dirpath(path)); 109 | if (d->dir == NULL) 110 | luaL_error (L, "cannot open %s.", path); 111 | #endif 112 | return 2; 113 | } 114 | 115 | 116 | /* 117 | ** Creates directory metatable. 118 | */ 119 | static int dir_create_meta (lua_State *L) { 120 | luaL_newmetatable (L, DIR_METATABLE); 121 | /* set its __gc field */ 122 | lua_pushstring (L, "__index"); 123 | lua_newtable(L); 124 | lua_pushstring (L, "next"); 125 | lua_pushcfunction (L, dir_iter); 126 | lua_settable(L, -3); 127 | lua_pushstring (L, "close"); 128 | lua_pushcfunction (L, dir_close); 129 | lua_settable(L, -3); 130 | lua_settable (L, -3); 131 | lua_pushstring (L, "__gc"); 132 | lua_pushcfunction (L, dir_close); 133 | lua_settable (L, -3); 134 | return 1; 135 | } 136 | 137 | int luaopen_lfs (lua_State *L) { 138 | dir_create_meta (L); 139 | return 1; 140 | } 141 | -------------------------------------------------------------------------------- /src/instead/snprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef _PORTABLE_SNPRINTF_H_ 2 | #define _PORTABLE_SNPRINTF_H_ 3 | 4 | #define PORTABLE_SNPRINTF_VERSION_MAJOR 1 5 | #define PORTABLE_SNPRINTF_VERSION_MINOR 3 6 | 7 | #ifdef HAVE_SNPRINTF 8 | #include 9 | #else 10 | extern int snprintf(char *, size_t, const char *, /*args*/ ...); 11 | #endif 12 | 13 | #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF) 14 | extern int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...); 15 | #define snprintf portable_snprintf 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/instead/system.h: -------------------------------------------------------------------------------- 1 | #ifndef __INSTEAD_EXTERNAL_H_ 2 | #define __INSTEAD_EXTERNAL_H_ 3 | 4 | #if defined(WINRT) 5 | #define errno 0 6 | #define putenv(a) ; 7 | #endif 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #if !defined(PLAN9) 28 | #include 29 | #include 30 | #endif 31 | 32 | #ifndef PATH_MAX 33 | #define PATH_MAX 4096 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/instead/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __INSTEAD_UTIL_H_INCLUDED 26 | #define __INSTEAD_UTIL_H_INCLUDED 27 | 28 | extern char *strip(char *s); 29 | 30 | extern int is_cjk(unsigned long sym); 31 | extern int get_utf8(const char *p, unsigned long *sym_out); 32 | 33 | extern int is_space(int c); 34 | extern int is_empty(const char *str); 35 | 36 | extern char *getfilepath(const char *d, const char *n); 37 | extern int strlowcmp(const char *s, const char *d); 38 | 39 | extern void unix_path(char *path); 40 | extern int setdir(const char *path); 41 | extern char *getpath(const char *d, const char *n); 42 | extern char *getdir(char *path, size_t size); 43 | extern char *dirpath(const char *path); 44 | extern void tolow(char *p); 45 | extern int is_absolute_path(const char *p); 46 | 47 | extern void mt_random_init(void); 48 | extern void mt_random_seed(unsigned long seed); 49 | extern unsigned long mt_random(void); 50 | extern double mt_random_double(void); 51 | 52 | #define FREE(v) do { if ((v)) free((v)); v = NULL; } while(0) 53 | 54 | #ifdef _USE_SDL 55 | #include 56 | #include 57 | #ifdef _USE_SDL_ICONV 58 | #include 59 | #define iconv SDL_iconv 60 | #define iconv_t SDL_iconv_t 61 | #define iconv_open SDL_iconv_open 62 | #define iconv_close SDL_iconv_close 63 | #else 64 | #ifdef _HAVE_ICONV 65 | #include 66 | #endif 67 | #endif 68 | #else 69 | #ifdef _HAVE_ICONV 70 | #include 71 | #endif 72 | #endif 73 | 74 | #ifdef _HAVE_ICONV 75 | extern char *decode(iconv_t hiconv, const char *s); 76 | #endif 77 | 78 | extern char *getrealpath(const char *path, char *resolved); 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/instead_paths.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2017 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #include "externals.h" 26 | #include "internals.h" 27 | 28 | #include "utils.h" 29 | 30 | static int luaB_get_savepath(lua_State *L) { 31 | lua_pushstring(L, dirname(game_save_path(1, 0))); 32 | return 1; 33 | } 34 | 35 | extern char *instead_exec; 36 | 37 | static int luaB_get_exepath(lua_State *L) { 38 | char instead_path[PATH_MAX]; 39 | if (instead_exec) { 40 | strcpy(instead_path, instead_exec); 41 | unix_path(instead_path); 42 | lua_pushstring(L, instead_exec); 43 | return 1; 44 | } 45 | return 0; 46 | } 47 | 48 | static int luaB_get_gamespath(lua_State *L) { 49 | char games_path[PATH_MAX]; 50 | if (GAMES_PATH[0] != '/') { 51 | strcpy(games_path, instead_cwd()); 52 | strcat(games_path, "/"); 53 | } else 54 | games_path[0] = 0; 55 | strcat(games_path, GAMES_PATH); 56 | unix_path(games_path); 57 | lua_pushstring(L, games_path); 58 | return 1; 59 | } 60 | 61 | const luaL_Reg paths_funcs[] = { 62 | {"instead_savepath", luaB_get_savepath}, 63 | {"instead_exepath", luaB_get_exepath}, 64 | {"instead_gamespath", luaB_get_gamespath}, 65 | { NULL, NULL } 66 | }; 67 | 68 | static int paths_init(void) 69 | { 70 | char path[PATH_MAX]; 71 | snprintf(path, sizeof(path), "%s/%s", instead_stead_path(), "/ext/paths.lua"); 72 | instead_api_register(paths_funcs); 73 | return instead_loadfile(dirpath(path)); 74 | } 75 | 76 | static struct instead_ext ext = { 77 | .init = paths_init, 78 | }; 79 | 80 | int instead_paths_init(void) 81 | { 82 | return instead_extension(&ext); 83 | } 84 | -------------------------------------------------------------------------------- /src/instead_timer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2017 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #include "externals.h" 26 | #include "internals.h" 27 | 28 | /* the Lua interpreter */ 29 | static gtimer_t instead_timer = NULL_TIMER; 30 | static int volatile instead_timer_nr = 0; 31 | 32 | static int instead_fn(int interval, void *p); 33 | 34 | static void instead_timer_do(void *data) 35 | { 36 | char *p; 37 | instead_timer_nr = 0; 38 | instead_lock(); 39 | if (game_paused() || !curgame_dir || instead_timer == NULL_TIMER) { 40 | instead_unlock(); 41 | return; 42 | } 43 | if (instead_function("stead.timer", NULL)) { 44 | instead_clear(); 45 | instead_unlock(); 46 | return; 47 | } 48 | p = instead_retval(0); instead_clear(); 49 | instead_unlock(); 50 | if (!p) 51 | return; 52 | game_cmd(p, 0); free(p); 53 | game_cursor(CURSOR_ON); 54 | } 55 | 56 | static int instead_fn(int interval, void *p) 57 | { 58 | if (instead_timer_nr > 0) { 59 | return interval; /* framedrop */ 60 | } 61 | instead_timer_nr ++; 62 | push_user_event(instead_timer_do, NULL); 63 | return interval; 64 | } 65 | 66 | static int luaB_set_timer(lua_State *L) { 67 | const char *delay = luaL_optstring(L, 1, NULL); 68 | int d; 69 | gfx_del_timer(instead_timer); 70 | instead_timer = NULL_TIMER; 71 | if (!delay) 72 | d = 0; 73 | else 74 | d = atoi(delay); 75 | if (!d) 76 | return 0; 77 | instead_timer_nr = 0; 78 | instead_timer = gfx_add_timer(d, instead_fn, NULL); 79 | return 0; 80 | } 81 | 82 | static const luaL_Reg timer_funcs[] = { 83 | {"instead_timer", luaB_set_timer}, 84 | {NULL, NULL} 85 | }; 86 | 87 | static int timer_done(void) 88 | { 89 | gfx_del_timer(instead_timer); 90 | instead_timer = NULL_TIMER; 91 | return 0; 92 | } 93 | 94 | static int timer_init(void) 95 | { 96 | char path[PATH_MAX]; 97 | snprintf(path, sizeof(path), "%s/%s", instead_stead_path(), "/ext/timer.lua"); 98 | instead_api_register(timer_funcs); 99 | return instead_loadfile(dirpath(path)); 100 | } 101 | 102 | static struct instead_ext ext = { 103 | .err = timer_done, 104 | .done = timer_done, /* to avoid loop errors */ 105 | .init = timer_init, 106 | }; 107 | int instead_timer_init(void) 108 | { 109 | return instead_extension(&ext); 110 | } 111 | -------------------------------------------------------------------------------- /src/internals.h: -------------------------------------------------------------------------------- 1 | #ifdef __IPHONEOS__ 2 | #include "ios.h" 3 | #endif 4 | 5 | #include "utils.h" 6 | #include "graphics.h" 7 | #include "sound.h" 8 | #include "game.h" 9 | #include "themes.h" 10 | #include "menu.h" 11 | #include "config.h" 12 | #include "input.h" 13 | #include "instead/instead.h" 14 | -------------------------------------------------------------------------------- /src/ios.h: -------------------------------------------------------------------------------- 1 | #ifndef _IOS_H_INCLUDED 2 | #define _IOS_H_INCLUDED 3 | #define VERSION "3.5.2" 4 | #define STEAD_PATH "__private__/stead" 5 | #define THEMES_PATH "__private__/themes" 6 | #define GAMES_PATH "__private__/games" 7 | #define ICON_PATH "__private__/icon" 8 | #define LANG_PATH "__private__/lang" 9 | extern int setup_inbox(void); 10 | extern void ios_cfg_init(void); 11 | #endif 12 | -------------------------------------------------------------------------------- /src/iowin32.h: -------------------------------------------------------------------------------- 1 | /* iowin32.h -- IO base function header for compress/uncompress .zip 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications for Zip64 support 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 9 | 10 | For more info read MiniZip_info.txt 11 | 12 | */ 13 | 14 | #include 15 | 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 22 | void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); 23 | void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); 24 | void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /src/menu.h: -------------------------------------------------------------------------------- 1 | #ifndef __MENU_H_INCLUDED 2 | #define __MENU_H_INCLUDED 3 | 4 | #if defined(IOS) || defined(SAILFISHOS) || defined(ANDROID) || defined(WINRT) 5 | #define MENU_GAMES_MAX 5 6 | #define MENU_THEMES_MAX 5 7 | #define MENU_PER_PAGER 5 8 | #else 9 | #define MENU_GAMES_MAX 8 10 | #define MENU_THEMES_MAX 8 11 | #define MENU_PER_PAGER 7 12 | #endif 13 | 14 | #define FONT_MIN_SZ -5 15 | #define FONT_MAX_SZ 30 16 | 17 | #define MAX_SAVE_SLOTS 6 18 | 19 | #define LANG_DEF "en" 20 | #define MAX_MENU_LINES 16 21 | 22 | extern int cur_menu; 23 | extern int top_menu; 24 | 25 | extern char *game_menu_gen(void); 26 | extern int game_menu_act(const char *a); 27 | extern void custom_theme_warn(void); 28 | extern int menu_langs_lookup(const char *path); 29 | extern int menu_lang_select(const char *name); 30 | extern int games_menu_maxw(void); 31 | extern int themes_menu_maxw(void); 32 | 33 | struct lang { 34 | char *path; 35 | char *name; 36 | char *file; 37 | }; 38 | extern struct lang *langs; 39 | extern int langs_nr; 40 | 41 | enum { 42 | menu_main = 1, 43 | menu_about, 44 | menu_about_instead, 45 | menu_settings, 46 | menu_quit, 47 | menu_askquit, 48 | menu_saved, 49 | menu_games, 50 | menu_themes, 51 | menu_own_theme, 52 | menu_custom_theme, 53 | menu_load, 54 | menu_save, 55 | menu_error, 56 | menu_warning, 57 | menu_remove, 58 | menu_wait, 59 | menu_max, 60 | }; 61 | 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/noise1234.h: -------------------------------------------------------------------------------- 1 | // noise1234 2 | // 3 | // Author: Stefan Gustavson, 2003-2005 4 | // Contact: stefan.gustavson@liu.se 5 | // 6 | // This code was GPL licensed until February 2011. 7 | // As the original author of this code, I hereby 8 | // release it into the public domain. 9 | // Please feel free to use it for whatever you want. 10 | // Credit is appreciated where appropriate, and I also 11 | // appreciate being told where this code finds any use, 12 | // but you may do as you like. 13 | 14 | /* 15 | * This implementation is "Improved Noise" as presented by 16 | * Ken Perlin at Siggraph 2002. The 3D function is a direct port 17 | * of his Java reference code which was once publicly available 18 | * on www.noisemachine.com (although I cleaned it up, made it 19 | * faster and made the code more readable), but the 1D, 2D and 20 | * 4D functions were implemented from scratch by me. 21 | * 22 | * This is a backport to C of my improved noise class in C++ 23 | * which was included in the Aqsis renderer project. 24 | * It is highly reusable without source code modifications. 25 | * 26 | */ 27 | 28 | /** 1D, 2D, 3D and 4D float Perlin noise 29 | */ 30 | extern float noise1( float x ); 31 | extern float noise2( float x, float y ); 32 | extern float noise3( float x, float y, float z ); 33 | extern float noise4( float x, float y, float z, float w ); 34 | 35 | /** 1D, 2D, 3D and 4D float Perlin periodic noise 36 | */ 37 | extern float pnoise1( float x, int px ); 38 | extern float pnoise2( float x, float y, int px, int py ); 39 | extern float pnoise3( float x, float y, float z, int px, int py, int pz ); 40 | extern float pnoise4( float x, float y, float z, float w, 41 | int px, int py, int pz, int pw ); 42 | -------------------------------------------------------------------------------- /src/resources.rc: -------------------------------------------------------------------------------- 1 | MAINICON ICON DISCARDABLE "../icon/sdl_instead.ico" 2 | -------------------------------------------------------------------------------- /src/sound.h: -------------------------------------------------------------------------------- 1 | #ifndef __SOUND_H__ 2 | #define __SOUND_H__ 3 | 4 | typedef void* wav_t; 5 | typedef struct _mus_t *mus_t; 6 | 7 | #define DEFAULT_CHUNKSIZE 1024 8 | 9 | /* extern mus_t snd_load_mus(const char *path); */ 10 | extern void snd_free_mus(mus_t mus); 11 | extern int snd_open(int hz); 12 | extern int snd_init(int hz); 13 | extern int snd_hz(void); 14 | extern int snd_play(wav_t chunk, int channel, int loop); 15 | extern void snd_halt_chan(int han, int ms); 16 | 17 | extern void snd_free_wav(wav_t chunk); 18 | extern wav_t snd_load_wav(const char *fname); 19 | 20 | #define SND_FMT_STEREO 1 21 | #define SND_FMT_44 2 22 | #define SND_FMT_22 4 23 | #define SND_FMT_11 8 24 | 25 | extern wav_t snd_load_mem(int fmt, const short *buf, size_t len); 26 | extern int snd_play_mus(char *music, int ms, int loop); 27 | extern void snd_mus_callback(void (*fn)(void *udata, unsigned char *stream, int len), void *arg); 28 | extern int snd_playing_mus(); 29 | extern void snd_stop_mus(int ms); 30 | extern int snd_volume_mus(int vol); 31 | extern void snd_done(void); 32 | extern void snd_close(void); 33 | extern int snd_vol_from_pcn(int v); 34 | extern int snd_vol_to_pcn(int v); 35 | extern int snd_playing(int channel); 36 | extern void snd_pause(int on); 37 | extern int snd_panning(int channel, int left, int right); 38 | extern int snd_enabled(void); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/tiny/Makefile: -------------------------------------------------------------------------------- 1 | include ../../Rules.make.standalone 2 | include ../../config.make 3 | 4 | CFLAGS += $(LUA_CFLAGS) $(EXTRA_CFLAGS) -DSTEAD_PATH=\"${STEADPATH}/\" -DVERSION=\"$(VERSION)\" 5 | 6 | LDFLAGS += $(LUA_LFLAGS) $(EXTRA_LDFLAGS) 7 | 8 | INSTEAD_SRC := instead.c util.c list.c cache.c idf.c tinymt32.c lfs.c 9 | 10 | SRC := $(INSTEAD_SRC) 11 | OBJ := $(patsubst %.c, %.o, $(SRC)) 12 | 13 | all: instead stead tiny-instead$(EXE) tiny-mp$(EXE) 14 | 15 | $(OBJ): %.o : instead/%.c 16 | $(CC) -c $(<) $(I) $(CFLAGS) $(CPPFLAGS) -o $(@) 17 | 18 | tiny-instead$(EXE): main.c $(OBJ) 19 | $(CC) $(CFLAGS) $(^) $(LDFLAGS) -o $(@) 20 | 21 | tiny-mp$(EXE): metaparser.c $(OBJ) 22 | $(CC) $(CFLAGS) $(^) $(LDFLAGS) -o $(@) 23 | 24 | instead: 25 | ln -s ../instead instead 26 | 27 | stead: 28 | ln -s ../../stead stead 29 | 30 | clean: 31 | $(RM) -f *.o instead stead tiny-instead$(EXE) tiny-mp$(EXE) 32 | -------------------------------------------------------------------------------- /src/tiny/ifbot/discord-bot/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "../ifbot" 5 | "flag" 6 | "fmt" 7 | "github.com/bwmarrin/discordgo" 8 | "hash/fnv" 9 | "os" 10 | "os/signal" 11 | "strings" 12 | "syscall" 13 | ) 14 | 15 | // Variables used for command line parameters 16 | var ( 17 | Token string 18 | Channels string 19 | ChannelsList []string 20 | ) 21 | 22 | func init() { 23 | 24 | flag.StringVar(&Token, "t", "", "Bot Token") 25 | flag.StringVar(&Channels, "c", "", "Channels") 26 | flag.Parse() 27 | } 28 | 29 | func main() { 30 | ChannelsList = strings.Split(Channels, ",") 31 | 32 | ifbot.SaveDir = "discord-saves/" 33 | // Create a new Discord session using the provided bot token. 34 | dg, err := discordgo.New("Bot " + Token) 35 | if err != nil { 36 | fmt.Println("error creating Discord session,", err) 37 | return 38 | } 39 | 40 | // Register the messageCreate func as a callback for MessageCreate events. 41 | dg.AddHandler(messageCreate) 42 | 43 | // Open a websocket connection to Discord and begin listening. 44 | err = dg.Open() 45 | if err != nil { 46 | fmt.Println("error opening connection,", err) 47 | return 48 | } 49 | 50 | // Wait here until CTRL-C or other term signal is received. 51 | fmt.Println("Bot is now running. Press CTRL-C to exit.") 52 | sc := make(chan os.Signal, 1) 53 | signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill) 54 | <-sc 55 | 56 | // Cleanly close down the Discord session. 57 | dg.Close() 58 | } 59 | 60 | func hash(s string) int64 { 61 | h := fnv.New32a() 62 | h.Write([]byte(s)) 63 | return int64(h.Sum32()) 64 | } 65 | 66 | func isPrivate(s *discordgo.Session, m *discordgo.MessageCreate) bool { 67 | channel, err := s.State.Channel(m.ChannelID) 68 | if err != nil { 69 | if channel, err = s.Channel(m.ChannelID); err != nil { 70 | return false 71 | } 72 | } 73 | return channel.Type == discordgo.ChannelTypeDM 74 | } 75 | 76 | func isChannel(s *discordgo.Session, m *discordgo.MessageCreate) bool { 77 | if len(ChannelsList) == 0 { 78 | return true 79 | } 80 | for _, id := range ChannelsList { 81 | if m.ChannelID == id { 82 | return true 83 | } 84 | } 85 | return false 86 | } 87 | 88 | func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { 89 | 90 | // Ignore all messages created by the bot itself 91 | // This isn't required in this specific example but it's a good practice. 92 | if m.Author.ID == s.State.User.ID { 93 | return 94 | } 95 | text := m.Content 96 | 97 | if !(isChannel(s, m) || isPrivate(s, m)) { 98 | return 99 | } 100 | reply := ifbot.Input(hash(m.ChannelID), text) 101 | s.ChannelMessageSend(m.ChannelID, reply) 102 | ifbot.Cleanup() 103 | } 104 | -------------------------------------------------------------------------------- /src/tiny/ifbot/tg-bot/main.go: -------------------------------------------------------------------------------- 1 | /* golang metaparser3 telegram bot */ 2 | package main 3 | 4 | import ( 5 | "../ifbot" 6 | "fmt" 7 | "github.com/Syfaro/telegram-bot-api" 8 | "log" 9 | "os" 10 | ) 11 | 12 | func main() { 13 | if len(os.Args) != 2 { 14 | fmt.Println("BOT Token missing") 15 | os.Exit(1) 16 | } 17 | bot, err := tgbotapi.NewBotAPI(os.Args[1]) 18 | if err != nil { 19 | log.Panic(err) 20 | } 21 | 22 | // bot.Debug = true 23 | log.Printf("Authorized on account %s", bot.Self.UserName) 24 | 25 | u := tgbotapi.NewUpdate(0) 26 | u.Timeout = 60 27 | 28 | updates, err := bot.GetUpdatesChan(u) 29 | for update := range updates { 30 | if update.Message == nil { 31 | continue 32 | } 33 | ChatID := update.Message.Chat.ID 34 | Text := update.Message.Text 35 | reply := ifbot.Input(ChatID, Text) 36 | msg := tgbotapi.NewMessage(ChatID, reply) 37 | bot.Send(msg) 38 | ifbot.Cleanup() 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/tiny/ifbot/tty/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "../ifbot" 5 | "bufio" 6 | "fmt" 7 | "os" 8 | ) 9 | 10 | func main() { 11 | scanner := bufio.NewScanner(os.Stdin) 12 | 13 | for scanner.Scan() { 14 | str := ifbot.Input(1, scanner.Text()) 15 | fmt.Printf(str) 16 | ifbot.Cleanup() 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/tiny/ifbot/vk-bot/main.go: -------------------------------------------------------------------------------- 1 | /* golang metaparser3 vk bot */ 2 | package main 3 | 4 | import ( 5 | "../ifbot" 6 | "fmt" 7 | "github.com/Dimonchik0036/vk-api" 8 | "log" 9 | "os" 10 | "strings" 11 | "time" 12 | ) 13 | 14 | func main() { 15 | if len(os.Args) != 2 { 16 | fmt.Println("BOT Token missing") 17 | os.Exit(1) 18 | } 19 | client, err := vkapi.NewClientFromToken(os.Args[1]) 20 | if err != nil { 21 | log.Panic(err) 22 | } 23 | 24 | // client.Log(true) 25 | if err := client.InitLongPoll(0, 2); err != nil { 26 | log.Panic(err) 27 | } 28 | updates, _, err := client.GetLPUpdatesChan(100, vkapi.LPConfig{25, vkapi.LPModeAttachments}) 29 | if err != nil { 30 | log.Panic(err) 31 | } 32 | 33 | ifbot.SaveDir = "vk-saves" 34 | 35 | for update := range updates { 36 | if update.Message == nil || !update.IsNewMessage() || update.Message.Outbox() { 37 | continue 38 | } 39 | ID := update.Message.FromID 40 | Text := update.Message.Text 41 | // log.Printf("Input: %s", Text) 42 | reply := ifbot.Input(ID, Text) 43 | // log.Printf("Output: %s", reply) 44 | lines := strings.Split(reply, "\n") 45 | chunk := "" 46 | for _, l := range lines { 47 | if len(chunk)+len(l) > 1024 { 48 | var first bool 49 | if chunk == "" { 50 | chunk = l + "\n" 51 | first = true 52 | } 53 | for count := 3; count > 0; count-- { 54 | rc, _ := client.SendMessage(vkapi.NewMessage(vkapi.NewDstFromUserID(ID), chunk)) 55 | if rc > 0 { 56 | break 57 | } 58 | time.Sleep(time.Second / 2.0) 59 | } 60 | if first { 61 | chunk = "" 62 | } else { 63 | chunk = l + "\n" 64 | } 65 | } else { 66 | chunk += (l + "\n") 67 | } 68 | } 69 | if chunk != "" { 70 | client.SendMessage(vkapi.NewMessage(vkapi.NewDstFromUserID(ID), chunk)) 71 | } 72 | ifbot.Cleanup() 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/tiny/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "instead/instead.h" 5 | static int log_opt = 0; 6 | static int tiny_init(void) 7 | { 8 | int rc; 9 | rc = instead_loadfile("tiny.lua"); 10 | if (rc) 11 | return rc; 12 | return 0; 13 | } 14 | static struct instead_ext ext = { 15 | .init = tiny_init, 16 | }; 17 | static void footer(void) 18 | { 19 | char *p; 20 | p = instead_cmd("way", NULL); 21 | if (p && *p) { 22 | printf(">> %s", p); free(p); 23 | } 24 | p = instead_cmd("inv", NULL); 25 | if (p && *p) { 26 | printf("** %s", p); free(p); 27 | } 28 | } 29 | int main(int argc, const char **argv) 30 | { 31 | int rc; char *str; const char *game = NULL; 32 | if (argc != 2) { 33 | fprintf(stderr, "Usage: %s \n", argv[0]); 34 | exit(1); 35 | } 36 | game = argv[1]; 37 | if (instead_extension(&ext)) { 38 | fprintf(stderr, "Can't register tiny extension\n"); 39 | exit(1); 40 | } 41 | instead_set_debug(1); 42 | if (instead_init(game)) { 43 | fprintf(stderr, "Can not init game: %s\n", game); 44 | exit(1); 45 | } 46 | if (instead_load(&str)) { 47 | fprintf(stderr, "Can not load game: %s\n", instead_err()); 48 | exit(1); 49 | } 50 | printf("%s\n", str); 51 | #if 0 /* no autoload */ 52 | str = instead_cmd("load autosave", &rc); 53 | #else 54 | str = instead_cmd("look", &rc); 55 | #endif 56 | if (!rc) { 57 | printf("%s", str); 58 | footer(); 59 | } 60 | free(str); 61 | while (1) { 62 | char input[128], *p, cmd[64]; 63 | p = fgets(input, sizeof(input), stdin); 64 | if (!p) 65 | break; 66 | printf(" * * *\n"); 67 | p[strcspn(p, "\n\r")] = 0; 68 | if (!strcmp(p, "quit")) 69 | break; 70 | if (!strcmp(p, "log")) { 71 | log_opt = 1; 72 | continue; 73 | } 74 | snprintf(cmd, sizeof(cmd), "use %s", p); 75 | str = instead_cmd(cmd, &rc); 76 | if (rc) { /* try go */ 77 | free(str); 78 | snprintf(cmd, sizeof(cmd), "go %s", p); 79 | str = instead_cmd(cmd, &rc); 80 | } 81 | if (rc) { /* try act */ 82 | free(str); 83 | snprintf(cmd, sizeof(cmd), "%s", p); 84 | str = instead_cmd(cmd, &rc); 85 | } 86 | if (str) 87 | printf("%s", str); 88 | free(str); 89 | if (rc) 90 | printf("error!\n"); 91 | else { 92 | footer(); 93 | if (log_opt) fprintf(stderr, "%s\n", p); 94 | } 95 | } 96 | instead_cmd("save autosave", NULL); 97 | instead_done(); 98 | exit(0); 99 | } 100 | -------------------------------------------------------------------------------- /src/tiny/metaparser.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "instead/instead.h" 5 | static int log_opt = 0; 6 | static int tiny_init(void) 7 | { 8 | int rc; 9 | rc = instead_loadfile("tiny.lua"); 10 | if (rc) 11 | return rc; 12 | return 0; 13 | } 14 | static struct instead_ext ext = { 15 | .init = tiny_init, 16 | }; 17 | 18 | int main(int argc, const char **argv) 19 | { 20 | int rc; char *str; const char *game = NULL; 21 | if (argc != 2) { 22 | fprintf(stderr, "Usage: %s \n", argv[0]); 23 | exit(1); 24 | } 25 | game = argv[1]; 26 | if (instead_extension(&ext)) { 27 | fprintf(stderr, "Can't register tiny extension\n"); 28 | exit(1); 29 | } 30 | instead_set_debug(1); 31 | 32 | if (instead_init(game)) { 33 | fprintf(stderr, "Can not init game: %s\n", game); 34 | exit(1); 35 | } 36 | if (instead_load(NULL)) { 37 | fprintf(stderr, "Can not load game: %s\n", instead_err()); 38 | exit(1); 39 | } 40 | #if 0 /* no autoload */ 41 | str = instead_cmd("load autosave", &rc); 42 | #else 43 | str = instead_cmd("look", &rc); 44 | #endif 45 | if (!rc) { 46 | printf("%s\n", str); fflush(stdout); 47 | } 48 | free(str); 49 | 50 | while (1) { 51 | char input[256], *p, cmd[256 + 64]; 52 | printf(">\n"); fflush(stdout); 53 | p = fgets(input, sizeof(input), stdin); 54 | if (!p) 55 | break; 56 | p[strcspn(p, "\n\r")] = 0; 57 | if (!strcmp(p, "quit")) 58 | break; 59 | if (!strcmp(p, "log")) { 60 | log_opt = 1; 61 | continue; 62 | } 63 | if (!strncmp(p, "load ", 5) || !strncmp(p, "save ", 5)) 64 | snprintf(cmd, sizeof(cmd), "%s", p); 65 | else 66 | snprintf(cmd, sizeof(cmd), "@metaparser \"%s\"", p); 67 | str = instead_cmd(cmd, &rc); 68 | if (rc && !str) /* menu? */ 69 | str = instead_cmd(p, NULL); 70 | if (str) { 71 | printf("%s\n", str); fflush(stdout); 72 | } 73 | free(str); 74 | if (log_opt) fprintf(stderr, "%s\n", p); 75 | } 76 | instead_cmd("save autosave", NULL); 77 | instead_done(); 78 | exit(0); 79 | } 80 | -------------------------------------------------------------------------------- /src/tiny/tiny.lua: -------------------------------------------------------------------------------- 1 | -- some stubs for tiny-instead 2 | -- fake game.gui 3 | -- stat, menu 4 | -- fake audio 5 | -- fake input 6 | 7 | if API == 'stead3' then 8 | dofile 'tiny3.lua' 9 | local instead = std '@instead' 10 | instead.savepath = function() return "./" end 11 | std.mod_start(function() 12 | std.mod_init(function() 13 | std.rawset(_G, 'instead', instead) 14 | require "ext/sandbox" 15 | end) 16 | local mp = std.ref '@metaparser' 17 | if mp then 18 | mp.msg.CUTSCENE_MORE = '^'..mp.msg.CUTSCENE_HELP 19 | end 20 | end) 21 | return 22 | end 23 | 24 | dofile 'tiny2.lua' 25 | -------------------------------------------------------------------------------- /src/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Peter Kosyh 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation files 6 | * (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, 8 | * publish, distribute, sublicense, and/or sell copies of the Software, 9 | * and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __UTIL_H_INCLUDED 26 | #define __UTIL_H_INCLUDED 27 | 28 | #include "instead/util.h" 29 | #include "instead/idf.h" 30 | #include "instead/cache.h" 31 | #include "instead/list.h" 32 | 33 | typedef int (*parser_fn)(const char *v, void *data); 34 | 35 | struct parser { 36 | const char *cmd; 37 | parser_fn fn; 38 | void *p; 39 | long aux; 40 | }; 41 | 42 | extern int parse_ini(const char *path, struct parser *cmd_parser); 43 | extern int parse_idff(idff_t idff, const char *path, struct parser *cmd_parser); 44 | 45 | extern char *lookup_tag(const char *fname, const char *tag, const char *comm); 46 | extern char *lookup_lang_tag(const char *fname, const char *tag, const char *comm, const char *lang); 47 | extern char *lookup_lang_tag_idf(idf_t idf, const char *fname, const char *tag, const char *comm, const char *lang); 48 | 49 | extern int parse_esc_string(const char *v, void *data); 50 | extern int parse_string(const char *v, void *data); 51 | extern int parse_int(const char *v, void *data); 52 | extern int parse_float(const char *v, void *data); 53 | 54 | extern int parse_full_path(const char *v, void *data); 55 | extern int parse_path(const char *v, void *data); 56 | extern int process_cmd(char *n, char *v, struct parser *cmd_parser); 57 | 58 | extern char *encode_esc_string(const char *v); 59 | extern char *find_in_esc(const char *l, const char *s); 60 | 61 | extern char *sdl_path(char *path); 62 | 63 | extern char *parse_tag(char *line, const char *tag, const char *comm, int *brk); 64 | extern int remove_dir(const char *path); 65 | 66 | extern void data2hex(const void *d, int len, void *o); 67 | extern int hex2data(const void *d, void *o, int len); 68 | extern void trunc_lines(char *pp, int max); 69 | extern void data_sync(void); /* rw data sync */ 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/zlib/Makefile: -------------------------------------------------------------------------------- 1 | include ../../Rules.make 2 | include ../../config.make 3 | 4 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ 5 | zutil.o inflate.o infback.o inftrees.o inffast.o 6 | 7 | all: libz.a 8 | 9 | libz.a: $(OBJS) $(OBJA) 10 | $(AR) $@ $(OBJS) $(OBJA) 11 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 12 | 13 | clean: 14 | rm -f *.o *.a 15 | 16 | install: 17 | 18 | -------------------------------------------------------------------------------- /src/zlib/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2003 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) 23 | Bytef *dest; 24 | uLongf *destLen; 25 | const Bytef *source; 26 | uLong sourceLen; 27 | int level; 28 | { 29 | z_stream stream; 30 | int err; 31 | 32 | stream.next_in = (Bytef*)source; 33 | stream.avail_in = (uInt)sourceLen; 34 | #ifdef MAXSEG_64K 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | #endif 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | stream.opaque = (voidpf)0; 45 | 46 | err = deflateInit(&stream, level); 47 | if (err != Z_OK) return err; 48 | 49 | err = deflate(&stream, Z_FINISH); 50 | if (err != Z_STREAM_END) { 51 | deflateEnd(&stream); 52 | return err == Z_OK ? Z_BUF_ERROR : err; 53 | } 54 | *destLen = stream.total_out; 55 | 56 | err = deflateEnd(&stream); 57 | return err; 58 | } 59 | 60 | /* =========================================================================== 61 | */ 62 | int ZEXPORT compress (dest, destLen, source, sourceLen) 63 | Bytef *dest; 64 | uLongf *destLen; 65 | const Bytef *source; 66 | uLong sourceLen; 67 | { 68 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 69 | } 70 | 71 | /* =========================================================================== 72 | If the default memLevel or windowBits for deflateInit() is changed, then 73 | this function needs to be updated. 74 | */ 75 | uLong ZEXPORT compressBound (sourceLen) 76 | uLong sourceLen; 77 | { 78 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; 79 | } 80 | -------------------------------------------------------------------------------- /src/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /src/zlib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of dynamic tree. The maximum found in a long but non- 39 | exhaustive search was 1444 code structures (852 for length/literals 40 | and 592 for distances, the latter actually the result of an 41 | exhaustive search). The true maximum is not known, but the value 42 | below is more than safe. */ 43 | #define ENOUGH 2048 44 | #define MAXD 592 45 | 46 | /* Type of code to build for inftable() */ 47 | typedef enum { 48 | CODES, 49 | LENS, 50 | DISTS 51 | } codetype; 52 | 53 | extern int inflate_table OF((codetype type, unsigned short FAR *lens, 54 | unsigned codes, code FAR * FAR *table, 55 | unsigned FAR *bits, unsigned short FAR *work)); 56 | -------------------------------------------------------------------------------- /src/zlib/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. sourceLen is 13 | the byte length of the source buffer. Upon entry, destLen is the total 14 | size of the destination buffer, which must be large enough to hold the 15 | entire uncompressed data. (The size of the uncompressed data must have 16 | been saved previously by the compressor and transmitted to the decompressor 17 | by some mechanism outside the scope of this compression library.) 18 | Upon exit, destLen is the actual size of the compressed buffer. 19 | This function can be used to decompress a whole file at once if the 20 | input file is mmap'ed. 21 | 22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 23 | enough memory, Z_BUF_ERROR if there was not enough room in the output 24 | buffer, or Z_DATA_ERROR if the input data was corrupted. 25 | */ 26 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 27 | Bytef *dest; 28 | uLongf *destLen; 29 | const Bytef *source; 30 | uLong sourceLen; 31 | { 32 | z_stream stream; 33 | int err; 34 | 35 | stream.next_in = (Bytef*)source; 36 | stream.avail_in = (uInt)sourceLen; 37 | /* Check for source > 64K on 16-bit machine: */ 38 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 39 | 40 | stream.next_out = dest; 41 | stream.avail_out = (uInt)*destLen; 42 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 43 | 44 | stream.zalloc = (alloc_func)0; 45 | stream.zfree = (free_func)0; 46 | 47 | err = inflateInit(&stream); 48 | if (err != Z_OK) return err; 49 | 50 | err = inflate(&stream, Z_FINISH); 51 | if (err != Z_STREAM_END) { 52 | inflateEnd(&stream); 53 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 54 | return Z_DATA_ERROR; 55 | return err; 56 | } 57 | *destLen = stream.total_out; 58 | 59 | err = inflateEnd(&stream); 60 | return err; 61 | } 62 | -------------------------------------------------------------------------------- /stead/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(stead2) 2 | ADD_SUBDIRECTORY(stead3) 3 | -------------------------------------------------------------------------------- /stead/Makefile: -------------------------------------------------------------------------------- 1 | include ../Rules.make 2 | include ../config.make 3 | 4 | clean: 5 | all: stead2/stead.lua stead3/stead.lua 6 | 7 | install: 8 | $(INSTALLD) $(DESTDIR)$(STEADPATH) 9 | 10 | for api in stead2 stead3; do \ 11 | $(INSTALLD) $(DESTDIR)$(STEADPATH)/$$api; \ 12 | $(INSTALLD) $(DESTDIR)$(STEADPATH)/$$api/ext; \ 13 | for f in $$api/*.lua; do \ 14 | $(INSTALL) $$f $(DESTDIR)$(STEADPATH)/$$f || exit 1; \ 15 | done; \ 16 | for f in $$api/ext/*.lua; do \ 17 | $(INSTALL) $$f $(DESTDIR)$(STEADPATH)/$$f || exit 1; \ 18 | done; \ 19 | done 20 | 21 | uninstall: 22 | -------------------------------------------------------------------------------- /stead/stead2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB STEAD_FILES "*.lua") 2 | FILE(GLOB STEAD_EXT_FILES "ext/*.lua") 3 | 4 | IF(SYSTEMWIDE) 5 | INSTALL(FILES ${STEAD_FILES} DESTINATION ${STEADDIR}/stead2) 6 | INSTALL(FILES ${STEAD_EXT_FILES} DESTINATION ${STEADDIR}/stead2/ext) 7 | ELSEIF(STANDALONE) 8 | INSTALL(FILES ${STEAD_FILES} DESTINATION ${STANDALONEDIR}/stead/stead2) 9 | INSTALL(FILES ${STEAD_EXT_FILES} DESTINATION ${STANDALONEDIR}/stead/stead2/ext) 10 | ENDIF(SYSTEMWIDE) 11 | -------------------------------------------------------------------------------- /stead/stead2/click.lua: -------------------------------------------------------------------------------- 1 | require "theme" 2 | 3 | click = { 4 | nam = 'click'; 5 | object_type = true; 6 | system_type = true; 7 | bg = false; 8 | press = false; 9 | button = false; 10 | save = function(self, name, h, need) 11 | local s = stead.tostring(self.bg) 12 | h:write(stead.string.format("click[%q] = %s;\n", 'bg', s)) 13 | s = stead.tostring(self.press) 14 | h:write(stead.string.format("click[%q] = %s;\n", 'press', s)) 15 | s = stead.tostring(self.button) 16 | h:write(stead.string.format("click[%q] = %s;\n", 'button', s)) 17 | end; 18 | } 19 | 20 | stead.module_init(function() 21 | input.click = stead.hook(input.click, 22 | function(f, s, press, mb, x, y, px, py, ...) 23 | local cmd = 'click ' 24 | local act = false 25 | if ( press or click.press ) and ( mb == 1 or click.button ) then 26 | cmd = cmd..stead.tostr(press)..','..stead.tostr(mb); 27 | 28 | if click.bg or theme.get 'scr.gfx.mode' == 'direct' then 29 | act = true 30 | cmd = cmd .. ',' .. x .. ','.. y 31 | end 32 | 33 | if px then 34 | act = true 35 | cmd = cmd .. ',' .. px .. ',' .. py 36 | end 37 | 38 | if act then 39 | return cmd 40 | end 41 | end 42 | return f(s, press, mb, x, y, px, py, ...) 43 | end) 44 | end) 45 | 46 | game.action = stead.hook(game.action, 47 | function(f, s, cmd, press, mb, x, y, px, py, ...) 48 | if cmd == 'click' then 49 | local r,v 50 | local x2 = px 51 | local y2 = py 52 | 53 | if stead.tonum(mb) then 54 | mb = stead.tonum(mb) 55 | end 56 | 57 | if stead.tonum(px) then 58 | x2 = stead.tonum(px) 59 | end 60 | 61 | if stead.tonum(py) then 62 | y2 = stead.tonum(py) 63 | end 64 | 65 | if stead.here().click then 66 | s = stead.here() 67 | end 68 | 69 | if press == 'true' then 70 | press = true 71 | else 72 | press = false 73 | end 74 | 75 | if s.click then 76 | if click.press then 77 | if click.button then 78 | r,v = stead.call(s, 'click', press, mb, stead.tonum(x), stead.tonum(y), x2, y2, ...); 79 | else 80 | r,v = stead.call(s, 'click', press, stead.tonum(x), stead.tonum(y), x2, y2, ...); 81 | end 82 | else 83 | if click.button then 84 | r,v = stead.call(s, 'click', mb, stead.tonum(x), stead.tonum(y), x2, y2, ...); 85 | else 86 | r,v = stead.call(s, 'click', stead.tonum(x), stead.tonum(y), x2, y2, ...); 87 | end 88 | end 89 | end 90 | if r == nil and v == nil and not stead.api_atleast(1, 3, 5) then 91 | return nil, true 92 | end 93 | return r,v 94 | end 95 | return f(s, cmd, press, mb, x, y, px, py, ...) 96 | end) 97 | -- vim:ts=4 98 | -------------------------------------------------------------------------------- /stead/stead2/counters.lua: -------------------------------------------------------------------------------- 1 | if not stead.api_atleast(1, 6, 3) then 2 | error ("Counters module can not run with api version < 1.6.3", 3) 3 | end 4 | 5 | local function inc_nr(v, n) 6 | local name = '__'..n..'_nr' 7 | if not v[name] then 8 | v[name] = 0 9 | end 10 | v[name] = v[name] + 1 11 | end 12 | 13 | local function read_nr(v, n, set) 14 | local name = '__'..n..'_nr' 15 | v = stead.ref(v) 16 | if stead.type(v) ~= 'table' then 17 | return v 18 | end 19 | if not v[name] then 20 | if stead.type(set) == 'number' then v[name] = set end 21 | return 0 22 | end 23 | n = v[name] 24 | if stead.type(set) == 'number' then v[name] = set end 25 | return n 26 | end 27 | 28 | game.onact = stead.hook(game.onact, function(f, v, w, ...) 29 | inc_nr(v, 'act'); 30 | inc_nr(w, 'act'); 31 | return f(v, w, ...) 32 | end) 33 | 34 | game.onuse = stead.hook(game.onuse, 35 | function(f, v, w, ...) 36 | inc_nr(v, 'use'); 37 | inc_nr(w, 'use'); 38 | return f(v, w, ...) 39 | end) 40 | 41 | game.oninv = stead.hook(game.oninv, 42 | function(f, v, w, ...) 43 | inc_nr(v, 'inv'); 44 | inc_nr(w, 'inv'); 45 | return f(v, w, ...) 46 | end) 47 | 48 | game.onwalk = stead.hook(game.onwalk, 49 | function(f, v, w, ...) 50 | inc_nr(v, 'walk'); 51 | inc_nr(w, 'walk'); 52 | return f(v, w, ...) 53 | end) 54 | 55 | function act_count(s, v) 56 | if not s and not v then 57 | s = game 58 | v = nil 59 | elseif stead.tonum(s) then 60 | v = s 61 | s = game 62 | end 63 | return read_nr(s, 'act', v) 64 | end 65 | 66 | function inv_count(s, v) 67 | if not s and not v then 68 | s = game 69 | v = nil 70 | elseif stead.tonum(s) then 71 | v = s 72 | s = game 73 | end 74 | return read_nr(s, 'inv', v) 75 | end 76 | 77 | function use_count(s, v) 78 | if not s and not v then 79 | s = game 80 | v = nil 81 | elseif stead.tonum(s) then 82 | v = s 83 | s = game 84 | end 85 | return read_nr(s, 'use', v) 86 | end 87 | 88 | function walk_count(s, v) 89 | if not s and not v then 90 | s = game 91 | v = nil 92 | elseif stead.tonum(s) then 93 | v = s 94 | s = game 95 | end 96 | return read_nr(s, 'walk', v) 97 | end 98 | -------------------------------------------------------------------------------- /stead/stead2/dash.lua: -------------------------------------------------------------------------------- 1 | require "format" 2 | format.dash = true 3 | -------------------------------------------------------------------------------- /stead/stead2/events.lua: -------------------------------------------------------------------------------- 1 | game.action = stead.hook(game.action, function(f, s, cmd, ...) 2 | if cmd == 'user_event' then 3 | local r,v; 4 | r, v = stead.call(stead, 'event', ... ); 5 | return r,v 6 | end 7 | return f(s, cmd, ...); 8 | end) 9 | 10 | stead.module_init(function() 11 | input.event = stead.hook(input.event, function(f, s, ev, ...) 12 | if type(stead.event) == 'function' then 13 | return 'user_event,'..tostring(ev) 14 | end 15 | return f(s, ev, ...) 16 | end) 17 | end) 18 | 19 | -- vim:ts=4 20 | -------------------------------------------------------------------------------- /stead/stead2/ext/paths.lua: -------------------------------------------------------------------------------- 1 | -- nothing todo in stead2 ;) 2 | local instead_gamepath = instead_gamepath 3 | io.open = stead.hook(io.open, function(f, path, acc, ...) 4 | if stead.type(path) == 'string' and path:sub(1, 1) ~= '/' and not 5 | (path:sub(2, 2) == ':' and path:find("^[A-Z]", 1) == 1) then 6 | path = instead_gamepath()..'/'..path 7 | end 8 | return f(path, acc, ...) 9 | end) 10 | -------------------------------------------------------------------------------- /stead/stead2/ext/sprites.lua: -------------------------------------------------------------------------------- 1 | stead.ticks = instead_ticks 2 | stead.mouse_pos = instead_mouse_pos 3 | stead.mouse_show = instead_mouse_show 4 | stead.finger_pos = instead_finger_pos 5 | stead.mouse_filter = instead_mouse_filter 6 | stead.busy = instead_busy 7 | 8 | mouse_pos = stead.mouse_pos 9 | mouse_filter = stead.mouse_filter 10 | 11 | get_ticks = stead.ticks 12 | 13 | local function compat_api() 14 | if not stead.api_atleast(1, 7, 1) then 15 | stead_busy = instead_busy 16 | theme_var = instead_theme_var 17 | theme_name = instead_theme_name 18 | get_themespath = instead_themespath 19 | end 20 | end 21 | 22 | stead.module_start(function(load) 23 | if compat_api and not load then 24 | compat_api() 25 | compat_api = nil 26 | end 27 | end) 28 | -------------------------------------------------------------------------------- /stead/stead2/ext/timer.lua: -------------------------------------------------------------------------------- 1 | stead.set_timer = instead_timer 2 | 3 | stead.timer = function() 4 | if stead.type(timer) == 'table' and stead.type(timer.callback) == 'function' then 5 | return timer:callback(); 6 | end 7 | return 8 | end 9 | 10 | stead.module_done(function(s) 11 | timer:stop() 12 | end) 13 | 14 | local function compat_api() 15 | if not stead.api_atleast(1, 7, 1) then 16 | set_timer = instead_timer 17 | end 18 | end 19 | 20 | stead.module_start(function(load) 21 | if compat_api and not load then 22 | compat_api() 23 | compat_api = nil 24 | end 25 | end) 26 | 27 | stead.module_init(function(s) 28 | timer = obj { -- timer calls stead.timer callback 29 | nam = 'timer', 30 | ini = function(s) 31 | if stead.tonum(s._timer) ~= nil and stead.type(stead.set_timer) == 'function' then 32 | stead.set_timer(s._timer); 33 | end 34 | end, 35 | get = function(s) 36 | if stead.tonum(s._timer) == nil then 37 | return 0 38 | end 39 | return stead.tonum(s._timer); 40 | end, 41 | stop = function(s) 42 | return s:set(0); 43 | end, 44 | del = function(s) 45 | return s:set(0); 46 | end, 47 | set = function(s, v) 48 | s._timer = stead.tonum(v); 49 | if stead.type(stead.set_timer) ~= 'function' then 50 | return false 51 | end 52 | stead.set_timer(v) 53 | return true 54 | end, 55 | --[[ callback = function(s) 56 | end, ]] 57 | }; 58 | end) 59 | -------------------------------------------------------------------------------- /stead/stead2/finger.lua: -------------------------------------------------------------------------------- 1 | require "theme" 2 | 3 | finger = { 4 | nam = 'finger'; 5 | object_type = true; 6 | system_type = true; 7 | fingers_list = { }; 8 | add = function(s, press, fid, x, y, px, py) 9 | if press then 10 | local v = s:lookup(fid) 11 | if v then 12 | v.x, v.y, v.px, v.py = x, y, px, py 13 | else 14 | stead.table.insert(s.fingers_list, 15 | { id = fid, x = x, y = y, px = px, py = py }) 16 | end 17 | return 18 | end 19 | local v, k 20 | v, k = s:lookup(fid) 21 | if k then 22 | stead.table.remove(s.fingers_list, k) 23 | return 24 | end 25 | end; 26 | list = function(s) 27 | local new = {} 28 | for k, v in stead.ipairs(s.fingers_list) do 29 | local x, y, pressure 30 | x, y, pressure = stead.finger_pos(v.id) 31 | if x then 32 | v.x, v.y, v.pressure = x, y, pressure 33 | stead.table.insert(new, v) 34 | end 35 | end 36 | s.fingers_list = new 37 | return new 38 | end; 39 | get = function(s, fid) 40 | local v,k 41 | local x, y, pressure 42 | x, y, pressure = stead.finger_pos(fid) 43 | if not x then 44 | v, k = s:lookup(fid) 45 | if k then 46 | stead.table.remove(s.fingers_list, k) 47 | end 48 | return 49 | end 50 | return x, y, pressure 51 | end; 52 | lookup = function(s, fid) 53 | for k, v in stead.ipairs(s.fingers_list) do 54 | if v.id == fid then 55 | return v, k 56 | end 57 | end 58 | end; 59 | } 60 | 61 | stead.module_init(function() 62 | input.finger = function(s, press, fid, x, y, px, py, ...) 63 | finger:add(press, fid, x, y, px, py, ...) 64 | local cmd = 'finger ' 65 | cmd = cmd..stead.tostr(press)..','..stead.tostr(fid)..',' .. x .. ','.. y; 66 | if px then 67 | cmd = cmd .. ',' .. px .. ',' .. py 68 | end 69 | return cmd 70 | end 71 | end) 72 | 73 | game.action = stead.hook(game.action, 74 | function(f, s, cmd, press, fid, x, y, px, py, ...) 75 | if cmd == 'finger' then 76 | local r,v 77 | local x2 = px 78 | local y2 = py 79 | 80 | if stead.here().finger then 81 | s = stead.here() 82 | end 83 | 84 | if not s.finger then 85 | return 86 | end 87 | 88 | if stead.tonum(px) then 89 | x2 = stead.tonum(px) 90 | end 91 | 92 | if stead.tonum(py) then 93 | y2 = stead.tonum(py) 94 | end 95 | 96 | if press == 'true' then 97 | press = true 98 | else 99 | press = false 100 | end 101 | r,v = stead.call(s, 'finger', press, fid, stead.tonum(x), stead.tonum(y), x2, y2, ...); 102 | return r,v 103 | end 104 | return f(s, cmd, press, fid, x, y, px, py, ...) 105 | end) 106 | -- vim:ts=4 107 | -------------------------------------------------------------------------------- /stead/stead2/format.lua: -------------------------------------------------------------------------------- 1 | format = { 2 | nam = 'format'; 3 | object_type = true; 4 | system_type = true; 5 | para = false; 6 | para_space = ' '; 7 | quotes = false; 8 | dash = false; 9 | filter = nil; 10 | nopara = '_'; 11 | save = function(self, name, h, need) 12 | for k, v in stead.pairs(self) do 13 | if k == 'para' or k == 'para_space' or k == 'quotes' or 14 | k == 'dash' or k == 'nopara' then 15 | local s = stead.tostring(v) 16 | h:write(stead.string.format("format[%q] = %s;\n", k, s)) 17 | end 18 | end 19 | end; 20 | } 21 | 22 | stead.fmt = stead.hook(stead.fmt, function(f, ...) 23 | local utf8 24 | local r = f(...) 25 | if game.codepage == 'UTF-8' or game.codepage == 'utf-8' then 26 | utf8 = true 27 | end 28 | if stead.type(r) == 'string' and stead.state then 29 | if stead.type(format.filter) == 'function' and stead.state then 30 | r = format.filter(r); 31 | end 32 | if stead.call_bool(format, 'dash') and utf8 then 33 | r = r:gsub('([^-])%-%-([^-])', '%1—%2'); 34 | r = r:gsub('^%-%-([^-])', '—%1'); 35 | end 36 | if stead.call_bool(format, 'quotes') and utf8 then 37 | r = r:gsub('_"','«'):gsub('"_',"»"); 38 | r = r:gsub('"([^"]*)"','«%1»'); 39 | r = r:gsub(',,','„'):gsub("''",'”'); 40 | end 41 | if stead.call_bool(format, 'para') then 42 | r = r:gsub('\n([^\n])', '<¶>%1'):gsub('<¶>[ \t]*'..format.nopara,'\n'):gsub('<¶>[ \t]*', '\n'..txtnb(format.para_space)); 43 | r = r:gsub('^[ \t]*', '<¶>'):gsub('<¶>[ \t]*'..format.nopara,''):gsub('<¶>[ \t]*', txtnb(format.para_space)); 44 | end 45 | end 46 | return r; 47 | end) 48 | 49 | -- vim:ts=4 50 | -------------------------------------------------------------------------------- /stead/stead2/hideinv.lua: -------------------------------------------------------------------------------- 1 | local attr = "hideinv" 2 | if stead.api_atleast(1, 6, 3) then 3 | game.gui.hideinv = function(s) 4 | if stead.call_bool(stead.here(), 'hideinv') then 5 | return true 6 | end 7 | end 8 | attr = "noinv" 9 | end 10 | room = stead.inherit(room, function(v) 11 | v.entered = stead.hook(v.entered, function(f, s, ...) 12 | if stead.call_bool(s, attr) then 13 | me():disable_all(); 14 | end 15 | return f(s, ...) 16 | end) 17 | v.left = stead.hook(v.left, function(f, s, ...) 18 | if stead.call_bool(s, attr) then 19 | me():enable_all(); 20 | end 21 | return f(s, ...) 22 | end) 23 | return v 24 | end) 25 | -------------------------------------------------------------------------------- /stead/stead2/hotkeys.lua: -------------------------------------------------------------------------------- 1 | require 'kbd' 2 | 3 | stead.module_init(function() 4 | hook_keys('1','2','3','4','5','6','7','8','9','0'); 5 | end) 6 | 7 | game.kbd = stead.hook(game.kbd, function(f, s, down, key, ...) 8 | if down and key >= '0' and key <= '9' then 9 | if isDialog(stead.here()) then 10 | if key == '0' then key = '10' end 11 | local p = stead.here():srch(key); 12 | if p and stead.nameof(p) == key then 13 | return stead.call(p, 'act'); 14 | end 15 | end 16 | return 17 | end 18 | return f(s, down, key, ...); 19 | end) 20 | 21 | -- vim:ts=4 22 | -------------------------------------------------------------------------------- /stead/stead2/kbd.lua: -------------------------------------------------------------------------------- 1 | game.action = stead.hook(game.action, function(f, s, cmd, ...) 2 | if cmd == 'user_kbd' then 3 | local r,v; 4 | if stead.here().kbd then 5 | r,v = stead.call(stead.here(), 'kbd', 6 | input.key_event.down, input.key_event.key); 7 | elseif s.kbd then 8 | r,v = stead.call(s, 'kbd', 9 | input.key_event.down, input.key_event.key); 10 | end 11 | if r == nil and v == nil and not stead.api_atleast(1, 3, 5) then 12 | return nil, true 13 | end 14 | return r,v 15 | end 16 | return f(s, cmd, ...); 17 | end) 18 | 19 | stead.module_init(function() 20 | input.key = stead.hook(input.key, function(f, s, down, key, ...) 21 | if input._key_hooks[key] then 22 | input.key_event = { key = key, down = down }; 23 | return 'user_kbd' 24 | end 25 | return f(s, down, key, ...) 26 | end) 27 | input._key_hooks = {} 28 | end) 29 | 30 | stead.hook_keys = function(...) 31 | local a = {...}; 32 | for i = 1, stead.table.maxn(a) do 33 | input._key_hooks[tostring(a[i])] = true; 34 | end 35 | end 36 | 37 | stead.unhook_keys = function(...) 38 | local a = {...}; 39 | for i = 1, stead.table.maxn(a) do 40 | input._key_hooks[tostring(a[i])] = nil; 41 | end 42 | end 43 | 44 | hook_keys = stead.hook_keys 45 | unhook_keys = stead.unhook_keys 46 | -- vim:ts=4 47 | -------------------------------------------------------------------------------- /stead/stead2/nolife.lua: -------------------------------------------------------------------------------- 1 | game.life = stead.hook(game.life, function(f, ...) 2 | if stead.call_bool(stead.here(), 'nolife') then 3 | return 4 | end 5 | return f(...) 6 | end) 7 | -------------------------------------------------------------------------------- /stead/stead2/nouse.lua: -------------------------------------------------------------------------------- 1 | game.use = function(s, w, o) 2 | local r, v 3 | r, v = stead.call(w, 'nouse', o); 4 | if not r and not v then 5 | r, v = stead.call(o, 'noused', w); 6 | end 7 | if not r and not v then 8 | r, v = stead.call(s, 'nouse', w, o) 9 | end 10 | return r, v 11 | end 12 | -------------------------------------------------------------------------------- /stead/stead2/para.lua: -------------------------------------------------------------------------------- 1 | require "format" 2 | format.para = true 3 | -------------------------------------------------------------------------------- /stead/stead2/pixels.lua: -------------------------------------------------------------------------------- 1 | require "sprites" 2 | 3 | local pixels_mt = { 4 | } 5 | 6 | local font_mt = { 7 | __gc = function(s) 8 | stead.font_free(s.fnt) 9 | end; 10 | __tostring = function(s) 11 | return s.fnt 12 | end; 13 | } 14 | 15 | local pnew = function(p) 16 | if stead.type(p) ~= 'userdata' then 17 | return 18 | end 19 | local t = getmetatable(p).__index 20 | setmetatable(t, pixels_mt) 21 | return p 22 | end 23 | 24 | local fnew = function(f) 25 | if stead.type(f) ~= 'string' then 26 | return 27 | end 28 | local fn = { 29 | fnt = f; 30 | save = function() end; 31 | } 32 | setmetatable(fn, font_mt) 33 | return fn 34 | end 35 | 36 | local font_m = { 37 | text = function(s, text, col, style, ...) 38 | return pnew(stead.sprite_pixels(stead.sprite_text(s.fnt, text, col, style, ...))) 39 | end; 40 | size = function(s, ...) 41 | return stead.sprite_text_size(s.fnt, ...); 42 | end; 43 | } 44 | 45 | local pixels_m = { 46 | save = function() end; 47 | dup = function(self) 48 | local w, h, s = self:size() 49 | local p = stead.sprite_pixels(w, h, s) 50 | if p then 51 | self:copy(p) 52 | end 53 | return pnew(p) 54 | end; 55 | } 56 | 57 | font_mt.__index = font_m 58 | pixels_mt.__index = pixels_m 59 | 60 | pixels = { 61 | nam = 'pixels'; 62 | object_type = true; 63 | system_type = true; 64 | fnt = function(name, sz, ...) 65 | if not stead.tonum(sz) then 66 | error("No font size specified.", 2) 67 | end 68 | return fnew(stead.font_load(name, -sz, ...)) 69 | end; 70 | new = function(...) 71 | return pnew(stead.sprite_pixels(...)) 72 | end; 73 | } 74 | -------------------------------------------------------------------------------- /stead/stead2/prefs.lua: -------------------------------------------------------------------------------- 1 | prefs = obj { 2 | nam = 'preferences', 3 | system_type = true, 4 | load = function(s) 5 | local name = instead_savepath() .. '/prefs'; 6 | local f, err = loadfile(name); 7 | if not f then return nil end 8 | f(); 9 | end, 10 | ini = function(s) 11 | return s:load() 12 | end, 13 | store = function(s) 14 | s:save() 15 | stead.clearvar(s); 16 | end, 17 | save = function(s) -- save prefs on every save 18 | local name = instead_savepath() .. '/prefs'; 19 | local name_tmp = name..'.tmp' 20 | local h = stead.io.open(name_tmp, "wb"); 21 | if not h then return false end 22 | stead.savemembers(h, s, 'prefs', true); 23 | h:flush(); 24 | h:close(); 25 | stead.os.remove(name); 26 | stead.os.rename(name_tmp, name); 27 | end, 28 | purge = function(s) 29 | local name = instead_savepath() .. '/prefs'; 30 | for k, v in stead.pairs(s) do 31 | if stead.type(v) ~= 'function' and k ~= 'nam' and k ~= 'system_type' then 32 | s[k] = nil 33 | end 34 | end 35 | return stead.os.remove(name); 36 | end 37 | }; 38 | 39 | -- vim:ts=4 40 | -------------------------------------------------------------------------------- /stead/stead2/quotes.lua: -------------------------------------------------------------------------------- 1 | require "format" 2 | format.quotes = true 3 | -------------------------------------------------------------------------------- /stead/stead2/snapshots.lua: -------------------------------------------------------------------------------- 1 | local MAKE_SNAPSHOT 2 | game._snapshots = {} 3 | stead.make_snapshot = function(nr) 4 | if not stead.tonum(nr) then nr = 0 end 5 | local h = { }; 6 | h.txt = '' 7 | h.write = function(s, ...) 8 | local a = {...}; 9 | for i = 1, stead.table.maxn(a) do 10 | s.txt = s.txt .. stead.tostr(a[i]); 11 | end 12 | end 13 | local old = game._snapshots; game._snapshots = nil 14 | stead.do_savegame(game, h); 15 | game._snapshots = old 16 | game._snapshots[nr] = h.txt; 17 | end 18 | 19 | function isSnapshot(nr) 20 | if not stead.tonum(nr) then nr = 0 end 21 | return (game._snapshots[nr] ~= nil) 22 | end 23 | 24 | stead.restore_snapshot = function (nr) 25 | if not stead.tonum(nr) then nr = 0 end 26 | local ss = game._snapshots 27 | if not ss[nr] then return nil, true end -- nothing todo 28 | local i,v 29 | 30 | if stead.api_atleast(1, 7, 1) then 31 | stead.gamereset("main.lua", true); 32 | else 33 | stead.gamefile("main.lua", true); 34 | end 35 | 36 | local f, err = stead.eval(ss[nr]..' '); 37 | if not f then return end 38 | local i,r = f(); 39 | game._snapshots = ss 40 | if r then 41 | return nil, false 42 | end 43 | 44 | i = stead.do_ini(game, true); 45 | 46 | if stead.api_atleast(1, 7, 1) then 47 | i = game:start() 48 | stead.rawset(_G, 'PLAYER_MOVED', true) -- force fading 49 | else -- legacy 50 | if not game.showlast then 51 | stead.last_disp(false) 52 | end 53 | i = stead.cat('', stead.last_disp()) 54 | end 55 | stead.rawset(_G, 'RAW_TEXT', true) 56 | -- delete_snapshot(nr); 57 | if stead.cctx() then 58 | stead.pr(i) 59 | end 60 | return i; 61 | end 62 | 63 | stead.delete_snapshot = function(nr) 64 | if not stead.tonum(nr) then nr = 0 end 65 | game._snapshots[nr] = nil 66 | end 67 | 68 | function make_snapshot(nr) 69 | if stead.type(nr) ~= 'number' then 70 | nr = 0 71 | end 72 | MAKE_SNAPSHOT = nr 73 | end 74 | 75 | function restore_snapshot(nr) 76 | return stead.restore_snapshot(nr) 77 | end 78 | 79 | function delete_snapshot(nr) 80 | return stead.delete_snapshot(nr); 81 | end 82 | 83 | iface.cmd = stead.hook(iface.cmd, function(f, ...) 84 | local r,v = f(...); 85 | if MAKE_SNAPSHOT ~= nil then 86 | stead.make_snapshot(MAKE_SNAPSHOT); 87 | MAKE_SNAPSHOT = nil 88 | end 89 | return r,v 90 | end) 91 | -- vim:ts=4 92 | -------------------------------------------------------------------------------- /stead/stead2/sound.lua: -------------------------------------------------------------------------------- 1 | stead.sound_load = instead_sound_load 2 | stead.sound_free = instead_sound_free 3 | stead.sounds_free = instead_sounds_free 4 | stead.sound_channel = instead_sound_channel 5 | stead.sound_volume = instead_sound_volume 6 | stead.sound_panning = instead_sound_panning 7 | stead.sound_load_mem = instead_sound_load_mem 8 | stead.music_callback = instead_music_callback 9 | 10 | sound = { 11 | nam = 'sound'; 12 | object_type = true; 13 | system_type = true; 14 | load = function(a, b, t) 15 | if type(a) == 'string' then 16 | return stead.sound_load(a); 17 | elseif type(t) == 'table' then 18 | return stead.sound_load_mem(a, b, t) -- hz, channel, t 19 | end 20 | end; 21 | music_callback = function(...) 22 | return stead.music_callback(...) 23 | end; 24 | free = function(key) 25 | return stead.sound_free(key); 26 | end; 27 | play = function(key, ...) 28 | return stead.add_sound(key, ...) 29 | end; 30 | stop = function(...) 31 | stead.stop_sound(...); 32 | end; 33 | playing = function(s,...) 34 | if stead.type(s) ~= 'number' then 35 | return stead.is_sound() 36 | end 37 | return stead.sound_channel(s,...) 38 | end; 39 | pan = function(c, l, r, ...) 40 | return stead.sound_panning(c, l, r, ...) 41 | end; 42 | vol = function(v, ...) 43 | return stead.sound_volume(v, ...) 44 | end 45 | } 46 | 47 | stead.module_init(function() 48 | stead.sounds_free(); 49 | end) 50 | -------------------------------------------------------------------------------- /stead/stead2/timer.lua: -------------------------------------------------------------------------------- 1 | game.action = stead.hook(game.action, function(f, s, cmd, ...) 2 | if cmd == 'user_timer' then 3 | local r,v 4 | if stead.here().timer then 5 | r,v = stead.call(stead.here(), 'timer'); 6 | elseif s.timer then 7 | r,v = stead.call(s, 'timer'); 8 | end 9 | if r == nil and v == nil and not stead.api_atleast(1, 3, 5) then 10 | return nil, true 11 | end 12 | return r,v 13 | end 14 | return f(s, cmd, ...); 15 | end) 16 | 17 | stead.module_init(function() 18 | timer.callback = function(s) 19 | return 'user_timer' 20 | end 21 | end) 22 | 23 | -- vim:ts=4 24 | -------------------------------------------------------------------------------- /stead/stead2/wroom.lua: -------------------------------------------------------------------------------- 1 | stead.wroom_enter = function(self, ...) 2 | local w = self.where 3 | if stead.type(w) ~= 'table' then 4 | w = stead.call(self, 'where') 5 | end 6 | local r, v = stead.walk(w); 7 | if v ~= false then 8 | self._toggle = true 9 | end 10 | return r, v 11 | end 12 | 13 | stead.wroom_save = function(self, name, h, need) 14 | if need then 15 | local a = stead.tostring(self.oldname); 16 | local b = stead.tostring(self.newname); 17 | local c = stead.tostring(self.where); 18 | 19 | if a == nil or b == nil or c == nil then 20 | error ("Can not save wroom "..name.."\nFunctions can not be saved, use code [[ ]]"); 21 | end 22 | local t = stead.string.format("%s = wroom(%s, %s, %s);\n", 23 | name, a, b, c); 24 | h:write(t); 25 | end 26 | stead.savemembers(h, self, name, false); 27 | end 28 | 29 | function wroom(a, b, c) 30 | local v = room { vroom_type = true, nam = a, where = c, enter = stead.wroom_enter, save = stead.wroom_save }; 31 | v.newname = b; 32 | v.oldname = a; 33 | v._toggle = false 34 | if c == nil then -- only two parameters 35 | v.newname = nil 36 | v.where = b 37 | end 38 | v.nam = function(s) 39 | if s._toggle and s.newname then 40 | return stead.call(s, 'newname') 41 | else 42 | return stead.call(s, 'oldname'); 43 | end 44 | end 45 | return v 46 | end 47 | -------------------------------------------------------------------------------- /stead/stead2/xact.lua: -------------------------------------------------------------------------------- 1 | xact = function(n, f) -- just simple action! 2 | local v = {}; 3 | 4 | if f == nil and stead.type(n) == 'table' then 5 | f = n[2]; 6 | n = n[1]; 7 | end 8 | 9 | if stead.type(n) ~= 'string' then 10 | error ("Wrong parameter to xact.", 2) 11 | end 12 | v.xaction_type = true 13 | v.nam = n 14 | if stead.api_atleast(1, 6, 3) then 15 | v.disp = false 16 | end 17 | v.act = f; 18 | v = obj(v); 19 | v.save = function(self, name, h, need) 20 | if need then 21 | local f = self.act; 22 | f = stead.tostring(f); 23 | if f == nil then 24 | error("Can not save xact: "..name); 25 | end 26 | h:write(stead.string.format("%s = xact(%q, %s);\n", name, self.nam, f)) 27 | end 28 | stead.savemembers(h, self, name, false); 29 | end 30 | return v 31 | end 32 | 33 | local __do_xact = function(str, self) 34 | local aarg = {} 35 | local function parg(v) 36 | stead.table.insert(aarg, v); 37 | return '' 38 | end 39 | local xrefrep = function(str) 40 | local s = stead.string.gsub(str,'[\001\002]',''); 41 | local o,d,a, oo; 42 | local delim = ':' 43 | 44 | if stead.api_atleast(1, 2, 2) then 45 | delim = stead.delim; 46 | end 47 | s = s:gsub('\\?[\\'..delim..']', { [ delim ] = '\001', [ '\\'..delim ] = delim }); 48 | local i = s:find('\001', 1, true); 49 | aarg = {} 50 | if i then 51 | o = s:sub(1, i - 1); 52 | d = s:sub(i + 1); 53 | i = o:find("(", 1, true); 54 | if i then 55 | a = o:sub(i); 56 | o = o:sub(1, i - 1); 57 | a:gsub('[^,()]+', parg); 58 | end 59 | if o == '' then 60 | if isObject(self) then 61 | oo = self 62 | else 63 | error("Empty link: "..s, 3); 64 | end 65 | else 66 | if stead.api_atleast(1, 6, 3) then 67 | oo = stead.here():srch(o) 68 | else 69 | oo = objs():srch(o) 70 | end 71 | if not oo then 72 | oo = stead.ref(o, true) 73 | end 74 | end 75 | elseif isObject(self) then 76 | oo = self 77 | d = s; 78 | else 79 | error("Wrong link: "..s, 3); 80 | end 81 | d = d:gsub("\001", delim); 82 | return stead.xref(d, stead.ref(oo, true), stead.unpack(aarg)); 83 | end 84 | if stead.type(str) ~= 'string' then return end 85 | local s = stead.string.gsub(str, '\\?[\\{}]', 86 | { ['{'] = '\001', ['}'] = '\002' }):gsub('\001([^\002]+)\002', xrefrep):gsub('[\001\002]', { ['\001'] = '{', ['\002'] = '}' }); 87 | return s; 88 | end 89 | 90 | stead.fmt = stead.hook(stead.fmt, function(f, ...) 91 | local res, s 92 | local a = {...} 93 | for i = 1, stead.table.maxn(a) do 94 | if stead.type(a[i]) == 'string' then 95 | s = __do_xact(a[i]); 96 | res = stead.par('', res, s):gsub('\\?[\\{}]', { [ '\\{' ] = '{', [ '\\}' ] = '}' }); 97 | end 98 | end 99 | return f(res); 100 | end) 101 | 102 | obj = stead.inherit(obj, function(v) 103 | v.xref = function(s, str) 104 | return __do_xact(str, s); 105 | end 106 | return v 107 | end) 108 | 109 | function xdsc(n) 110 | local v = {} 111 | v.nam = true 112 | if n == nil then 113 | v.disp = 'xdsc' 114 | elseif stead.type(n) == 'string' then 115 | v.disp = n; 116 | else 117 | error("Wrong parameter to xdsc.", 2); 118 | end 119 | v.dsc = function(s) 120 | return stead.call(stead.here(), s.disp); 121 | end 122 | v.save = function(self, name, h, need) 123 | if need then 124 | h:write(stead.string.format("%s = xdsc(%q);\n", name, self.disp)) 125 | end 126 | stead.savemembers(h, self, name, false); 127 | end 128 | return obj(v) 129 | end 130 | 131 | xroom = stead.inherit(room, function(v) 132 | v.look = stead.hook(v.look, function(f, s,...) 133 | local xdsc = stead.call(s, 'xdsc'); 134 | return stead.par(stead.space_delim, xdsc, f(s, ...)); 135 | end) 136 | return v 137 | end) 138 | 139 | if stead.api_atleast(1, 6, 3) then 140 | xwalk = xact('xwalk', code [[ stead.walk(arg1) ]]); 141 | xwalk.system_type = true 142 | end 143 | 144 | -- vim:ts=4 145 | -------------------------------------------------------------------------------- /stead/stead3/.luacheckrc: -------------------------------------------------------------------------------- 1 | globals = { 2 | 'stead', 3 | 'LANG', 4 | } 5 | -------------------------------------------------------------------------------- /stead/stead3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB STEAD_FILES "*.lua") 2 | FILE(GLOB STEAD_EXT_FILES "ext/*.lua") 3 | 4 | IF(SYSTEMWIDE) 5 | INSTALL(FILES ${STEAD_FILES} DESTINATION ${STEADDIR}/stead3) 6 | INSTALL(FILES ${STEAD_EXT_FILES} DESTINATION ${STEADDIR}/stead3/ext) 7 | ELSEIF(STANDALONE) 8 | INSTALL(FILES ${STEAD_FILES} DESTINATION ${STANDALONEDIR}/stead/stead3) 9 | INSTALL(FILES ${STEAD_EXT_FILES} DESTINATION ${STANDALONEDIR}/stead/stead3/ext) 10 | ENDIF(SYSTEMWIDE) 11 | -------------------------------------------------------------------------------- /stead/stead3/click.lua: -------------------------------------------------------------------------------- 1 | local std = stead 2 | local input = std.ref '@input' 3 | 4 | -- luacheck: globals click 5 | 6 | click = std.obj { 7 | nam = '@click'; 8 | -- luacheck: no unused args 9 | filter = function(s, press, btn, x, y, px, py) 10 | -- luacheck: unused args 11 | return press and px 12 | end 13 | } 14 | 15 | function input:wheel(x, y) 16 | local a 17 | for _, v in std.ipairs {'scroll', x, y} do 18 | a = (a and (a..', ') or ' ') .. std.dump(v) 19 | end 20 | return '@click'.. (a or '') 21 | end 22 | 23 | function input:click(press, btn, x, y, px, py) 24 | local a 25 | if not click:filter(press, btn, x, y, px, py) then 26 | return 27 | end 28 | for _, v in std.ipairs {'click', press, btn, x, y, px, py} do 29 | a = (a and (a..', ') or ' ') .. std.dump(v) 30 | end 31 | return '@click'.. (a or '') 32 | end 33 | 34 | std.mod_cmd(function(cmd) 35 | if cmd[1] ~= '@click' then 36 | return 37 | end 38 | if cmd[2] ~= 'click' and cmd[2] ~= 'scroll' then 39 | return 40 | end 41 | local r, v 42 | r, v = std.call(std.here(), 'on'..cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8]) 43 | if not r and not v then 44 | r, v = std.call(std.game, 'on'..cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8]) 45 | end 46 | if not r and not v then -- nothing todo 47 | return nil, false 48 | end 49 | return r, v 50 | end) 51 | -------------------------------------------------------------------------------- /stead/stead3/dbg-ru.lua: -------------------------------------------------------------------------------- 1 | local kbden = { 2 | shifted = { 3 | ["1"] = "!", 4 | ["2"] = "@", 5 | ["3"] = "#", 6 | ["4"] = "$", 7 | ["5"] = "%", 8 | ["6"] = "^", 9 | ["7"] = "&", 10 | ["8"] = "*", 11 | ["9"] = "(", 12 | ["0"] = ")", 13 | ["-"] = "_", 14 | ["="] = "+", 15 | ["["] = "{", 16 | ["]"] = "}", 17 | ["\\"] = "|", 18 | [";"] = ":", 19 | ["'"] = "\"", 20 | [","] = "<", 21 | ["."] = ">", 22 | ["/"] = "?", 23 | } 24 | } 25 | 26 | local kbdru = { 27 | ["q"] = "й", 28 | ["w"] = "ц", 29 | ["e"] = "у", 30 | ["r"] = "к", 31 | ["t"] = "е", 32 | ["y"] = "н", 33 | ["u"] = "г", 34 | ["i"] = "ш", 35 | ["o"] = "щ", 36 | ["p"] = "з", 37 | ["["] = "х", 38 | ["]"] = "ъ", 39 | ["a"] = "ф", 40 | ["s"] = "ы", 41 | ["d"] = "в", 42 | ["f"] = "а", 43 | ["g"] = "п", 44 | ["h"] = "р", 45 | ["j"] = "о", 46 | ["k"] = "л", 47 | ["l"] = "д", 48 | [";"] = "ж", 49 | ["'"] = "э", 50 | ["z"] = "я", 51 | ["x"] = "ч", 52 | ["c"] = "с", 53 | ["v"] = "м", 54 | ["b"] = "и", 55 | ["n"] = "т", 56 | ["m"] = "ь", 57 | [","] = "б", 58 | ["."] = "ю", 59 | ["`"] = "ё", 60 | 61 | shifted = { 62 | ["q"] = "Й", 63 | ["w"] = "Ц", 64 | ["e"] = "У", 65 | ["r"] = "К", 66 | ["t"] = "Е", 67 | ["y"] = "Н", 68 | ["u"] = "Г", 69 | ["i"] = "Ш", 70 | ["o"] = "Щ", 71 | ["p"] = "З", 72 | ["["] = "Х", 73 | ["]"] = "Ъ", 74 | ["a"] = "Ф", 75 | ["s"] = "Ы", 76 | ["d"] = "В", 77 | ["f"] = "А", 78 | ["g"] = "П", 79 | ["h"] = "Р", 80 | ["j"] = "О", 81 | ["k"] = "Л", 82 | ["l"] = "Д", 83 | [";"] = "Ж", 84 | ["'"] = "Э", 85 | ["z"] = "Я", 86 | ["x"] = "Ч", 87 | ["c"] = "С", 88 | ["v"] = "М", 89 | ["b"] = "И", 90 | ["n"] = "Т", 91 | ["m"] = "Ь", 92 | [","] = "Б", 93 | ["."] = "Ю", 94 | ["`"] = "Ё", 95 | ["1"] = "!", 96 | ["2"] = "@", 97 | ["3"] = "#", 98 | ["4"] = ";", 99 | ["5"] = "%", 100 | ["6"] = ":", 101 | ["7"] = "?", 102 | ["8"] = "*", 103 | ["9"] = "(", 104 | ["0"] = ")", 105 | ["-"] = "_", 106 | ["="] = "+", 107 | } 108 | } 109 | return { main = kbden, alt = kbdru } 110 | -------------------------------------------------------------------------------- /stead/stead3/events.lua: -------------------------------------------------------------------------------- 1 | local std = stead 2 | local input = std.ref '@input' 3 | local instead = std.ref '@instead' 4 | 5 | -- luacheck: no self 6 | function input:event(...) 7 | -- luacheck: self 8 | local a 9 | for _, v in std.ipairs {...} do 10 | a = (a and (a..', ') or ' ') .. std.dump(v) 11 | end 12 | return '@user_event'.. a or '' 13 | end 14 | 15 | std.mod_cmd(function(cmd) 16 | if cmd[1] ~= '@user_event' then 17 | return 18 | end 19 | local r, v = std.call(instead, 'onevent', cmd[2]) 20 | if not r and not v then -- nothing todo 21 | return nil, false 22 | end 23 | return r, v 24 | end) 25 | -------------------------------------------------------------------------------- /stead/stead3/ext/paths.lua: -------------------------------------------------------------------------------- 1 | local std = stead 2 | local instead = std.ref '@instead' 3 | -- luacheck: read globals instead_savepath 4 | -- luacheck: read globals instead_gamepath 5 | -- luacheck: read globals instead_exepath 6 | -- luacheck: globals io 7 | instead.savepath = instead_savepath 8 | std.savepath = instead_savepath 9 | instead.gamepath = instead_gamepath 10 | instead.exepath = instead_exepath 11 | 12 | io.open = stead.hook(io.open, function(f, path, acc, ...) 13 | if std.type(path) == 'string' and path:sub(1, 1) ~= '/' and not 14 | (path:sub(2, 2) == ':' and path:find("^[A-Z]", 1) == 1) then 15 | path = instead.gamepath()..'/'..path 16 | end 17 | return f(path, acc, ...) 18 | end) 19 | -------------------------------------------------------------------------------- /stead/stead3/ext/timer.lua: -------------------------------------------------------------------------------- 1 | -- raw iface to timer 2 | -- luacheck: read globals instead_timer 3 | local std = stead 4 | local type = std.type 5 | 6 | local instead = std.ref '@instead' 7 | 8 | instead.timer = instead_timer 9 | 10 | local timer = std.obj { 11 | nam = '@timer'; 12 | ini = function(s) 13 | if s.__timer then 14 | s:set(s.__timer) 15 | end 16 | end; 17 | get = function(s) 18 | return s.__timer or 0; 19 | end; 20 | stop = function(s) 21 | return s:set(0) 22 | end; 23 | set = function(s, v) 24 | if type(v) ~= 'number' then 25 | std.err("Wrong argument to timer:set(): "..std.tostr(v), 2) 26 | end 27 | s.__timer = v 28 | instead.timer(s.__timer) 29 | return true 30 | end; 31 | callback = function(_) 32 | return '@timer' 33 | end 34 | } 35 | 36 | std.timer = function() -- sdl part call this one 37 | if std.type(timer.callback) == 'function' then 38 | return timer:callback(); 39 | end 40 | return 41 | end 42 | 43 | std.mod_done(function(_) 44 | timer:stop() 45 | end) 46 | 47 | std.mod_cmd(function(cmd) 48 | if cmd[1] ~= '@timer' then 49 | return 50 | end 51 | local r, v = std.call(stead.here(), 'timer'); 52 | if not r and not v then 53 | r, v = stead.call(std.game, 'timer'); 54 | end 55 | if not r and not v then -- nothing todo 56 | return nil, false 57 | end 58 | return r, v 59 | end) 60 | -------------------------------------------------------------------------------- /stead/stead3/finger.lua: -------------------------------------------------------------------------------- 1 | -- luacheck: globals finger 2 | local std = stead 3 | local input = std.ref '@input' 4 | local table = table 5 | local instead = std.ref '@instead' 6 | 7 | finger = std.obj { 8 | nam = '@finger'; 9 | { 10 | fingers_list = { }; 11 | }; 12 | -- luacheck: no unused args 13 | filter = function(s, press, fid, x, y, px, py) -- by default, all finger events 14 | -- luacheck: unused args 15 | return true 16 | end 17 | } 18 | 19 | function finger:event(press, fid, x, y, px, py) 20 | local s = self 21 | if press then 22 | local v = s:lookup(fid) 23 | if v then 24 | v.x, v.y, v.px, v.py = x, y, px, py 25 | else 26 | table.insert(s.fingers_list, 27 | { id = fid, x = x, y = y, px = px, py = py }) 28 | end 29 | return 30 | end 31 | local _, k = s:lookup(fid) 32 | if k then 33 | table.remove(s.fingers_list, k) 34 | end 35 | end 36 | 37 | function finger:list() 38 | local s = self 39 | local new = {} 40 | for _, v in std.ipairs(s.fingers_list) do 41 | local x, y, pressure = instead.finger_pos(v.id) 42 | if x then 43 | v.x, v.y, v.pressure = x, y, pressure 44 | table.insert(new, v) 45 | end 46 | end 47 | s.fingers_list = new 48 | return new 49 | end 50 | 51 | function finger:get(fid) 52 | local s = self 53 | local _, k 54 | local x, y, pressure = instead.finger_pos(fid) 55 | if not x then 56 | _, k = s:lookup(fid) 57 | if k then 58 | table.remove(s.fingers_list, k) 59 | end 60 | return 61 | end 62 | return x, y, pressure 63 | end 64 | 65 | function finger:lookup(fid) 66 | local s = self 67 | for k, v in std.ipairs(s.fingers_list) do 68 | if v.id == fid then 69 | return v, k 70 | end 71 | end 72 | end 73 | 74 | function input:finger(press, fid, x, y, px, py, ...) 75 | local a 76 | finger:event(press, fid, x, y, px, py, ...) 77 | if not finger:filter(press, fid, x, y, px, py, ...) then 78 | return 79 | end 80 | for _, v in std.ipairs {press, fid, x, y, px, py, ...} do 81 | a = (a and (a..', ') or ' ') .. std.dump(v) 82 | end 83 | return '@finger'.. (a or '') 84 | end 85 | 86 | std.mod_cmd(function(cmd) 87 | if cmd[1] ~= '@finger' then 88 | return 89 | end 90 | local r, v 91 | r, v = std.call(std.here(), 'onfinger', cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) 92 | if not r and not v then 93 | r, v = std.call(std.game, 'onfinger', cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) 94 | end 95 | if not r and not v then -- nothing todo 96 | return nil, false 97 | end 98 | return r, v 99 | end) 100 | -------------------------------------------------------------------------------- /stead/stead3/fmt.lua: -------------------------------------------------------------------------------- 1 | local std = stead 2 | local type = std.type 3 | local iface = std.ref '@iface' 4 | 5 | -- luacheck: globals fmt 6 | 7 | fmt = std.obj { 8 | nam = '@format'; 9 | para = false; 10 | nopara = '_'; 11 | para_space = ' '; 12 | quotes = true; 13 | dash = true; 14 | filter = nil; 15 | } 16 | 17 | std.obj { 18 | nam = '$fmt'; 19 | act = function(_, w, ...) 20 | if type(w) ~= 'string' or not fmt[w] then 21 | return w 22 | end 23 | return fmt[w](...) 24 | end 25 | } 26 | 27 | std.format = function(r, state) 28 | local utf8 = (std.ref 'game'.codepage == 'UTF-8' or std.ref 'game'.codepage == 'utf-8') 29 | 30 | if type(r) ~= 'string' then 31 | return r 32 | end 33 | 34 | if type(fmt.filter) == 'function' then 35 | r = fmt.filter(r, state) 36 | end 37 | 38 | if utf8 then 39 | if fmt.dash then 40 | r = r:gsub("%-%-%-*", { ['--'] = '—' }) 41 | r = r:gsub("^([^ \t]*)—[ \t]+", "%1— "); 42 | r = r:gsub("(\n[^ \t]*)—[ \t]+", "%1— "); 43 | r = r:gsub("[ \t]+—", iface:nb('').."—"); -- do not break dash 44 | end 45 | if fmt.quotes then 46 | r = r:gsub('_"','«'):gsub('"_',"»"); 47 | r = r:gsub('"([^"]*)"','«%1»'); 48 | r = r:gsub(',,','„'):gsub("''",'”'); 49 | end 50 | end 51 | if not state then 52 | return r 53 | end 54 | 55 | if fmt.para then 56 | r = r:gsub('\n([^\n])', '\001%1'):gsub('\001[ \t]*'..fmt.nopara,'\n'): 57 | gsub('\001[ \t]*', '\n'..iface:nb(fmt.para_space)); 58 | r = r:gsub('^[ \t]*', '\001'):gsub('\001[ \t]*'..fmt.nopara,''): 59 | gsub('\001[ \t]*', iface:nb(fmt.para_space)); 60 | end 61 | return r 62 | end 63 | 64 | function fmt.em(str) 65 | return iface:em(str) 66 | end 67 | 68 | function fmt.c(str) 69 | return iface:center(str) 70 | end 71 | 72 | function fmt.j(str) 73 | return iface:just(str) 74 | end 75 | 76 | function fmt.l(str) 77 | return iface:left(str) 78 | end 79 | 80 | function fmt.r(str) 81 | return iface:right(str) 82 | end 83 | 84 | function fmt.b(str) 85 | return iface:bold(str) 86 | end 87 | 88 | function fmt.top(str) 89 | return iface:top(str) 90 | end 91 | 92 | function fmt.bottom(str) 93 | return iface:bottom(str) 94 | end 95 | 96 | function fmt.middle(str) 97 | return iface:middle(str) 98 | end 99 | 100 | function fmt.nb(str) 101 | return iface:nb(str) 102 | end 103 | 104 | function fmt.anchor(str) 105 | return iface:anchor(str) 106 | end 107 | 108 | function fmt.img(str) 109 | return iface:img(str) 110 | end 111 | 112 | function fmt.imgl(str) 113 | return iface:imgl(str) 114 | end 115 | 116 | function fmt.imgr(str) 117 | return iface:imgr(str) 118 | end 119 | 120 | function fmt.u(str) 121 | return iface:under(str) 122 | end 123 | 124 | function fmt.st(str) 125 | return iface:st(str) 126 | end 127 | 128 | function fmt.tab(str, al) 129 | return iface:tab(str, al) 130 | end 131 | 132 | function fmt.y(str, al) 133 | return iface:y(str, al) 134 | end 135 | -------------------------------------------------------------------------------- /stead/stead3/keys.lua: -------------------------------------------------------------------------------- 1 | local std = stead 2 | local input = std.ref '@input' 3 | 4 | -- luacheck: globals keys 5 | 6 | keys = std.obj { 7 | nam = '@keys'; 8 | { 9 | __alt = false; 10 | __ctrl = false; 11 | __shift = false; 12 | __state = {}; 13 | }; 14 | state = function(s, key) 15 | return s.__state[key] or false 16 | end; 17 | event = function(s, press, key) 18 | if key:find 'alt' then 19 | key = 'alt' 20 | elseif key:find 'ctrl' then 21 | key = 'ctrl' 22 | elseif key:find 'shift' then 23 | key = 'shift' 24 | end 25 | s.__state[key] = press 26 | end; 27 | -- luacheck: no unused args 28 | filter = function(s, press, key) 29 | -- luacheck: unused args 30 | return false 31 | end 32 | } 33 | 34 | function input:key(press, key) 35 | local a 36 | 37 | keys:event(press, key) 38 | 39 | if not keys:filter(press, key) then 40 | return 41 | end 42 | 43 | for _, v in std.ipairs {press, key} do 44 | a = (a and (a..', ') or ' ') .. std.dump(v) 45 | end 46 | return '@key'.. (a or '') 47 | end 48 | 49 | std.mod_cmd(function(cmd) 50 | if cmd[1] ~= '@key' then 51 | return 52 | end 53 | local r, v 54 | r, v = std.call(std.here(), 'onkey', cmd[2], cmd[3]) 55 | if not r and not v then 56 | r, v = std.call(std.game, 'onkey', cmd[2], cmd[3]) 57 | end 58 | if not r and not v then -- nothing todo 59 | return nil, false 60 | end 61 | return r, v 62 | end) 63 | -------------------------------------------------------------------------------- /stead/stead3/noinv.lua: -------------------------------------------------------------------------------- 1 | local std = stead 2 | 3 | std.mod_step(function(state) 4 | if not state then 5 | return 6 | end 7 | if std.here().noinv and not std.me().__inv_disabled then 8 | std.me():close() 9 | std.me().__inv_disabled = true 10 | elseif std.me().__inv_disabled and not std.here().noinv then 11 | std.me():open() 12 | std.me().__inv_disabled = nil 13 | end 14 | end) 15 | 16 | std.mod_done(function() 17 | if std.me().__inv_disabled then 18 | std.me():open() 19 | std.me().__inv_disabled = nil 20 | end 21 | end) 22 | -------------------------------------------------------------------------------- /stead/stead3/nolife.lua: -------------------------------------------------------------------------------- 1 | local std = stead 2 | 3 | std.mod_step(function(state) 4 | if not state then 5 | return 6 | end 7 | if std.here().nolife and std.game:live() then 8 | std.game:lifeoff() 9 | elseif not std.game:live() and not std.here().nolife then 10 | std.game:lifeon() 11 | end 12 | end) 13 | 14 | std.mod_done(function() 15 | if not std.game:live() then 16 | std.game:lifeon() 17 | end 18 | end) 19 | -------------------------------------------------------------------------------- /stead/stead3/prefs.lua: -------------------------------------------------------------------------------- 1 | -- luacheck: globals prefs 2 | 3 | local std = stead 4 | 5 | local preferences = std.obj { 6 | nam = '@prefs', 7 | load = function(_) 8 | local name = std.savepath() .. '/prefs'; 9 | local f, err = std.loadfile(name); 10 | if not f then 11 | return false, err 12 | end 13 | local strict = std.nostrict; std.nostrict = true 14 | f(); 15 | std.nostrict = strict 16 | return true 17 | end, 18 | store = function(s) 19 | return s:save() 20 | end, 21 | save = function(s) -- save prefs on every save 22 | local name = std.savepath() .. '/prefs'; 23 | local name_tmp = name..'.tmp' 24 | local fp, _ = std.io.open(name_tmp, "wb"); 25 | if not fp then 26 | return false 27 | end 28 | std.obj.save(s, fp, 'std "@prefs"') 29 | fp:flush(); 30 | fp:close(); 31 | std.os.remove(name) 32 | return std.os.rename(name_tmp, name); 33 | end, 34 | purge = function(_) 35 | local name = std.savepath() .. '/prefs'; 36 | return std.os.remove(name); 37 | end 38 | }; 39 | 40 | local loaded 41 | 42 | std.mod_start(function() 43 | loaded = prefs:load() 44 | end) 45 | 46 | std.mod_done(function() 47 | if loaded then 48 | prefs:store() 49 | loaded = false 50 | end 51 | end) 52 | 53 | prefs = preferences 54 | -------------------------------------------------------------------------------- /stead/stead3/snapshots.lua: -------------------------------------------------------------------------------- 1 | -- luacheck: globals snapshots 2 | 3 | local std = stead 4 | 5 | local SNAPSHOT = false 6 | local INWRITE = false 7 | 8 | local snap = std.obj { 9 | nam = '@snapshots'; 10 | data = {}; 11 | save = function(s, ...) 12 | if INWRITE then return end 13 | return std.obj.save(s, ...) 14 | end; 15 | write = function(s, name) 16 | name = name or 'default' 17 | local fp = { -- fake file object 18 | data = ''; 19 | write = function(self, str) 20 | self.data = self.data .. str 21 | end; 22 | } 23 | INWRITE = true std:save(fp) INWRITE = false 24 | s.data[name] = fp.data 25 | end; 26 | make = function(_, name) 27 | SNAPSHOT = name or 'default' 28 | end; 29 | exists = function(s, name) 30 | name = name or 'default' 31 | return s.data[name] 32 | end; 33 | remove = function(s, name) 34 | name = name or 'default' 35 | s.data[name] = nil 36 | end; 37 | restore = function(s, name) -- like std:load() 38 | name = name or 'default' 39 | if not s:exists(name) then 40 | return false 41 | end 42 | std:reset() 43 | std.ref 'game':__ini() 44 | local f, err = std.eval(s.data[name]) 45 | if not f then 46 | std.err(err, 2) 47 | end 48 | f(); 49 | std.ref 'game':__ini() 50 | std.ref 'game':__start(true) 51 | return std.nop() 52 | end; 53 | } 54 | 55 | snapshots = snap 56 | 57 | std.mod_cmd(function() 58 | if SNAPSHOT then 59 | snap:write(SNAPSHOT) 60 | SNAPSHOT = nil 61 | end 62 | end) 63 | 64 | -- std.mod_done(function() 65 | -- end) 66 | -------------------------------------------------------------------------------- /stead/stead3/snd.lua: -------------------------------------------------------------------------------- 1 | -- luacheck: globals snd 2 | snd = stead.ref '@snd' -------------------------------------------------------------------------------- /stead/stead3/sprite.lua: -------------------------------------------------------------------------------- 1 | -- luacheck: globals sprite pixels 2 | sprite = stead.ref '@sprite' 3 | pixels = stead.ref '@pixels' 4 | -------------------------------------------------------------------------------- /stead/stead3/theme.lua: -------------------------------------------------------------------------------- 1 | -- luacheck: globals theme 2 | theme = stead.ref '@theme' 3 | -------------------------------------------------------------------------------- /stead/stead3/timer.lua: -------------------------------------------------------------------------------- 1 | -- luacheck: globals timer 2 | timer = stead.ref '@timer' 3 | -------------------------------------------------------------------------------- /themes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(THEMES arctic bluesteel book clearlooks default fantasy wide mobile) 2 | 3 | IF(SYSTEMWIDE) 4 | FOREACH(THEME ${THEMES}) 5 | INSTALL(DIRECTORY ${THEME} DESTINATION ${THEMESDIR} PATTERN ".svn" EXCLUDE) 6 | ENDFOREACH(THEME) 7 | ELSEIF(STANDALONE) 8 | FOREACH(THEME ${THEMES}) 9 | INSTALL(DIRECTORY ${THEME} DESTINATION ${STANDALONEDIR}/themes PATTERN ".svn" EXCLUDE) 10 | ENDFOREACH(THEME) 11 | ENDIF(SYSTEMWIDE) 12 | -------------------------------------------------------------------------------- /themes/Makefile: -------------------------------------------------------------------------------- 1 | include ../Rules.make 2 | include ../config.make 3 | 4 | clean: 5 | all: 6 | install: 7 | $(INSTALLD) $(DESTDIR)$(THEMESPATH) 8 | for f in *; do \ 9 | if [ ! -d $$f ]; then continue; fi;\ 10 | $(INSTALLD) $(DESTDIR)$(THEMESPATH)/$$f;\ 11 | tar --exclude=".svn" -cf - -C $$f . | tar -xpf - -C $(DESTDIR)$(THEMESPATH)/$$f;\ 12 | done 13 | 14 | uninstall: 15 | $(RM) -rf $(DESTDIR)$(THEMESPATH) 16 | 17 | -------------------------------------------------------------------------------- /themes/arctic/adown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/arctic/adown.png -------------------------------------------------------------------------------- /themes/arctic/aup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/arctic/aup.png -------------------------------------------------------------------------------- /themes/arctic/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/arctic/bg.png -------------------------------------------------------------------------------- /themes/arctic/cursor-use.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/arctic/cursor-use.png -------------------------------------------------------------------------------- /themes/arctic/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/arctic/cursor.png -------------------------------------------------------------------------------- /themes/arctic/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/arctic/menu.png -------------------------------------------------------------------------------- /themes/arctic/theme.ini: -------------------------------------------------------------------------------- 1 | ; $Name: Arctic$ 2 | ; $Name(ru): Арктика$ 3 | ; $Name(uk): Арктика$ 4 | ; $Name(es): Artico$ 5 | ; $Name(it): Artico$ 6 | 7 | scr.w = 800 8 | scr.h = 600 9 | scr.gfx.bg = bg.png 10 | scr.col.bg = white 11 | scr.gfx.cursor.x = 1 12 | scr.gfx.cursor.y = 1 13 | scr.gfx.cursor.normal = cursor.png 14 | scr.gfx.cursor.use = cursor-use.png 15 | scr.gfx.pad = 16 16 | scr.gfx.mode = embedded 17 | win.gfx.h = -1 ;unlim 18 | 19 | win.x = 30 20 | win.y = 16 21 | win.w = 526 22 | win.h = 562 23 | win.gfx.up = aup.png 24 | win.gfx.down = adown.png 25 | 26 | win.col.fg = #000000 27 | win.col.link = #41516a 28 | win.col.alink = #1f2837 29 | 30 | inv.x = 620 31 | inv.y = 16 32 | inv.w = 140 33 | inv.h = 548 34 | inv.gfx.up = aup.png 35 | inv.gfx.down = adown.png 36 | 37 | inv.col.fg = #1f2837 38 | inv.col.link = #000000 39 | inv.col.alink = #41516a 40 | inv.mode = vertical 41 | 42 | menu.col.bg = white; #b7bdc9 43 | menu.col.fg = black 44 | menu.col.link = blue; #1f2837 45 | menu.col.alink = red; #41516a 46 | menu.col.alpha = 210 47 | menu.col.border = #45536d 48 | menu.bw = 1 49 | menu.gfx.button = menu.png 50 | menu.button.x = 768 51 | menu.button.y = 568 52 | -------------------------------------------------------------------------------- /themes/bluesteel/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/bluesteel/bg.png -------------------------------------------------------------------------------- /themes/bluesteel/cursor-use.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/bluesteel/cursor-use.png -------------------------------------------------------------------------------- /themes/bluesteel/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/bluesteel/cursor.png -------------------------------------------------------------------------------- /themes/bluesteel/downarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/bluesteel/downarrow.png -------------------------------------------------------------------------------- /themes/bluesteel/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/bluesteel/menu.png -------------------------------------------------------------------------------- /themes/bluesteel/theme.ini: -------------------------------------------------------------------------------- 1 | ; $Name: Blue Steel$ 2 | ; $Name(ru): Голубая cталь$ 3 | ; $Name(uk): Блакитна сталь$ 4 | ; $Name(es): Acero azul$ 5 | ; $Name(it): Acciaio Blu$ 6 | 7 | scr.w = 800 8 | scr.h = 600 9 | scr.gfx.bg = bg.png 10 | scr.col.bg = white 11 | scr.gfx.cursor.x = 1 12 | scr.gfx.cursor.y = 1 13 | scr.gfx.cursor.normal = cursor.png 14 | scr.gfx.cursor.use = cursor-use.png 15 | scr.gfx.pad = 7 16 | scr.gfx.mode = embedded 17 | win.gfx.h = -1 ;unlim 18 | 19 | win.x = 34 20 | win.y = 54 21 | win.w = 480 22 | win.h = 500 23 | win.gfx.up = uparrow.png 24 | win.gfx.down = downarrow.png 25 | 26 | win.col.fg = #cfcfdf 27 | win.col.link = #ffffff 28 | win.col.alink = gold 29 | 30 | inv.x = 576 31 | inv.y = 54 32 | inv.w = 170 33 | inv.h = 500 34 | inv.gfx.up = uparrow.png 35 | inv.gfx.down = downarrow.png 36 | 37 | inv.col.fg = #cfcfdf 38 | inv.col.link = #ffffff 39 | inv.col.alink = gold 40 | inv.mode = vertical 41 | 42 | menu.col.bg = #29282e 43 | menu.col.fg = #bdbdbf 44 | menu.col.link = #ffffff; #dcdbe0 45 | menu.col.alink = #00ff00 46 | menu.col.alpha = 245 47 | menu.col.border = #bdbdbf 48 | menu.bw = 2 49 | menu.gfx.button = menu.png 50 | menu.button.x = 742 51 | menu.button.y = 581 52 | -------------------------------------------------------------------------------- /themes/bluesteel/uparrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/bluesteel/uparrow.png -------------------------------------------------------------------------------- /themes/book/book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/book/book.png -------------------------------------------------------------------------------- /themes/book/theme.ini: -------------------------------------------------------------------------------- 1 | ; $Name:Book$ 2 | ; $Name(ru):Книга$ 3 | ; $Name(uk):Книга$ 4 | ; $Name(es):Libro$ 5 | ; $Name(it):Libro$ 6 | 7 | scr.w = 800 8 | scr.h = 600 9 | scr.gfx.bg = book.png 10 | scr.col.bg = white 11 | 12 | scr.gfx.x = 18 13 | scr.gfx.y = 36 14 | scr.gfx.w = 344 15 | scr.gfx.h = 410 16 | scr.gfx.mode = float 17 | 18 | win.x = 400 19 | win.y = 18 20 | win.w = 350 21 | win.h = 550 22 | 23 | win.col.fg = #000000 24 | win.col.link = #a02c00 25 | win.col.alink = #606060 26 | 27 | menu.button.y = 576 28 | 29 | inv.x = 30 30 | inv.y = 460 31 | inv.w = 320 32 | inv.h = 100 33 | 34 | inv.col.fg = #000000 35 | inv.col.link = #902c00 36 | inv.col.alink = #606060 37 | 38 | inv.mode = horizontal 39 | -------------------------------------------------------------------------------- /themes/clearlooks/adown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/clearlooks/adown.png -------------------------------------------------------------------------------- /themes/clearlooks/aup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/clearlooks/aup.png -------------------------------------------------------------------------------- /themes/clearlooks/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/clearlooks/bg.jpg -------------------------------------------------------------------------------- /themes/clearlooks/cursor-use.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/clearlooks/cursor-use.png -------------------------------------------------------------------------------- /themes/clearlooks/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/clearlooks/cursor.png -------------------------------------------------------------------------------- /themes/clearlooks/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/clearlooks/menu.png -------------------------------------------------------------------------------- /themes/clearlooks/theme.ini: -------------------------------------------------------------------------------- 1 | ; $Name: Clear looks$ 2 | ; $Name(ru): Ясная$ 3 | ; $Name(uk): Ясна$ 4 | ; $Name(es): Parece claro$ 5 | ; $Name(it): Aspetto Chiaro$ 6 | 7 | scr.w = 800 8 | scr.h = 600 9 | scr.gfx.h = -1 10 | 11 | scr.gfx.bg = bg.jpg 12 | scr.col.bg = black 13 | scr.gfx.cursor.x = 2 14 | scr.gfx.cursor.y = 2 15 | scr.gfx.cursor.normal = cursor.png 16 | scr.gfx.cursor.use = cursor-use.png 17 | scr.gfx.pad = 8 18 | scr.gfx.mode = embedded 19 | 20 | win.x = 245 21 | win.y = 21 22 | win.w = 520 23 | win.h = 558 24 | 25 | ; win.fnt.name = sans.ttf 26 | win.fnt.size = 16 27 | win.gfx.up = aup.png 28 | win.gfx.down = adown.png 29 | win.col.fg = black 30 | win.col.link = #b02c00 31 | win.col.alink = #606060 32 | 33 | inv.x = 10 34 | inv.y = 21 35 | inv.w = 190 36 | inv.h = 550 37 | 38 | ; inv.fnt.name = sans.ttf 39 | inv.fnt.size = 16 40 | inv.gfx.up = aup.png 41 | inv.gfx.down = adown.png 42 | inv.col.fg = #606060 43 | inv.col.link = #000000 44 | inv.col.alink = #b02c00 45 | inv.mode = vertical-right 46 | 47 | menu.col.bg = #f0f0f0 48 | menu.col.fg = #000000 49 | menu.col.link = #b02c00 50 | menu.col.alink = #606060 51 | menu.col.alpha = 230 52 | menu.col.border = #606060 53 | menu.bw = 2 54 | ;menu.fnt.name = sans.ttf 55 | menu.fnt.size = 16 56 | menu.gfx.button = menu.png 57 | menu.button.x = 0 58 | menu.button.y = 576 59 | 60 | 61 | ; snd.click = click.wav ; click.ogg 62 | 63 | ; 800x480 version 64 | ;scr.w = 800 65 | ;scr.h = 480 66 | ;win.h = 448 67 | ;inv.h = 448 68 | ;menu.button.y = 456 69 | -------------------------------------------------------------------------------- /themes/default/adown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/adown.png -------------------------------------------------------------------------------- /themes/default/aup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/aup.png -------------------------------------------------------------------------------- /themes/default/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/bg.png -------------------------------------------------------------------------------- /themes/default/click.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/click.ogg -------------------------------------------------------------------------------- /themes/default/click.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/click.wav -------------------------------------------------------------------------------- /themes/default/cursor-use.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/cursor-use.png -------------------------------------------------------------------------------- /themes/default/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/cursor.png -------------------------------------------------------------------------------- /themes/default/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/menu.png -------------------------------------------------------------------------------- /themes/default/sans-b.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/sans-b.ttf -------------------------------------------------------------------------------- /themes/default/sans-bi.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/sans-bi.ttf -------------------------------------------------------------------------------- /themes/default/sans-i.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/sans-i.ttf -------------------------------------------------------------------------------- /themes/default/sans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/sans.ttf -------------------------------------------------------------------------------- /themes/default/theme.ini: -------------------------------------------------------------------------------- 1 | ; $Name: Standard$ 2 | ; $Name(ru): Стандартная$ 3 | ; $Name(uk): Стандартна$ 4 | ; $Name(es): Estándar$ 5 | ; $Name(it): Predefinito$ 6 | 7 | scr.w = 800 8 | scr.h = 600 9 | scr.dpi = 96 10 | scr.gfx.scalable = 1 11 | scr.scale_aware = 0 12 | scr.gfx.scale = 1.0 13 | scr.gfx.h = -1 14 | 15 | scr.gfx.bg = bg.png 16 | scr.col.bg = white 17 | scr.col.brd = black 18 | scr.gfx.cursor.x = 2 19 | scr.gfx.cursor.y = 2 20 | scr.gfx.cursor.normal = cursor.png 21 | scr.gfx.cursor.use = cursor-use.png 22 | scr.gfx.pad = 16 23 | scr.gfx.mode = embedded 24 | 25 | win.align = justify 26 | win.x = 48 27 | win.y = 8 28 | win.w = 500 29 | win.h = 568 30 | 31 | win.fnt.name = {sans,sans-b,sans-i,sans-bi}.ttf 32 | win.fnt.size = 16 33 | win.fnt.height = 1.0 34 | win.gfx.up = aup.png 35 | win.gfx.down = adown.png 36 | win.col.fg = black 37 | win.col.link = #b02c00 38 | win.col.alink = #606060 39 | win.up.x = -1 40 | win.up.y = -1 41 | win.down.x = -1 42 | win.down.y = -1 43 | win.scroll.mode = 2 44 | win.ways.mode = top 45 | 46 | inv.x = 620 47 | inv.y = 8 48 | inv.w = 144 49 | inv.h = 564 50 | 51 | inv.fnt.name = {sans,sans-b,sans-i,sans-bi}.ttf 52 | inv.fnt.size = 16 53 | inv.fnt.height = 1.0 54 | inv.gfx.up = aup.png 55 | inv.gfx.down = adown.png 56 | inv.col.fg = #CCCCCC 57 | inv.col.link = #CCCCCC 58 | inv.col.alink = goldenrod 59 | inv.mode = vertical-left 60 | inv.up.x = -1 61 | inv.up.y = -1 62 | inv.down.x = -1 63 | inv.down.y = -1 64 | 65 | menu.col.bg = white 66 | menu.col.fg = black 67 | menu.col.link = blue 68 | menu.col.alink = red 69 | menu.col.alpha = 220 70 | menu.col.border = black 71 | menu.bw = 1 72 | menu.fnt.name = {sans,,sans-i}.ttf 73 | menu.fnt.size = 16 74 | menu.fnt.height = 1.0 75 | menu.gfx.button = menu.png 76 | menu.button.x = 776 77 | menu.button.y = 576 78 | 79 | 80 | snd.click = click.wav ; click.ogg 81 | 82 | ; 800x480 version 83 | ;scr.w = 800 84 | ;scr.h = 480 85 | ;win.h = 448 86 | ;inv.h = 448 87 | ;menu.button.y = 456 88 | 89 | -------------------------------------------------------------------------------- /themes/default/use.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/default/use.png -------------------------------------------------------------------------------- /themes/fantasy/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/fantasy/bg.png -------------------------------------------------------------------------------- /themes/fantasy/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/fantasy/down.png -------------------------------------------------------------------------------- /themes/fantasy/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/fantasy/menu.png -------------------------------------------------------------------------------- /themes/fantasy/theme.ini: -------------------------------------------------------------------------------- 1 | ;$Name:Fantasy$ 2 | ;$Name(ru):Фэнтези$ 3 | ;$Name(uk):Фентезі$ 4 | ;$Name(es):Fantasía$ 5 | ;$Name(it):Fantasia$ 6 | 7 | scr.w = 800 8 | scr.h = 600 9 | 10 | scr.gfx.bg = bg.png 11 | 12 | win.col.fg = #00CD00 13 | win.col.link = #CDC673 ;#9ACD32 14 | win.col.alink = red 15 | scr.gfx.pad = 8 16 | 17 | inv.col.fg = #CDC5BF;#FFEC8B 18 | inv.col.link = #CDC5BF; #EEDC82 19 | inv.col.alink = red 20 | 21 | menu.col.bg = black 22 | menu.col.border = #CDC673 23 | menu.col.fg = #CDC673 24 | menu.col.link = #CDC5BF 25 | menu.col.alink = red 26 | 27 | scr.gfx.h = 384 28 | ;scr.gfx.mode = fixed 29 | ;scr.gfx.h = 300 30 | 31 | win.x = 60 32 | win.y = 60 33 | win.w = 514 34 | win.h = 464 35 | 36 | inv.x = 645 37 | inv.y = 16 38 | inv.w = 127 39 | inv.h = 508 40 | 41 | win.gfx.down = down.png 42 | win.gfx.up = up.png 43 | menu.gfx.button = menu.png 44 | menu.button.x = 645 45 | menu.button.y = 545 46 | inv.gfx.up = up.png 47 | inv.gfx.down = down.png 48 | -------------------------------------------------------------------------------- /themes/fantasy/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/fantasy/up.png -------------------------------------------------------------------------------- /themes/mobile/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/mobile/bg.png -------------------------------------------------------------------------------- /themes/mobile/theme.ini: -------------------------------------------------------------------------------- 1 | ; $Name: Mobile$ 2 | ; $Name(ru): Мобильная$ 3 | 4 | scr.w = 576 5 | scr.h = 1024 6 | 7 | scr.gfx.bg = bg.png 8 | 9 | win.align = left 10 | 11 | win.x = 24 12 | win.y = 16 13 | win.w = 510 14 | win.h = 768 15 | 16 | inv.x = 24 17 | inv.y = 820 18 | inv.w = 510 19 | inv.h = 176 20 | inv.mode = horizontal-left 21 | 22 | win.fnt.size = 18 23 | win.fnt.height = 1.2 24 | 25 | inv.fnt.size = 18 26 | inv.fnt.height = 1.2 27 | 28 | menu.fnt.size = 18 29 | menu.fnt.height = 1.2 30 | 31 | menu.button.y = 1000 32 | menu.button.x = 552 33 | -------------------------------------------------------------------------------- /themes/wide/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instead-hub/instead/80b81e7bdee26631fbcb1c8e71fba3d8bfd0c081/themes/wide/bg.png -------------------------------------------------------------------------------- /themes/wide/theme.ini: -------------------------------------------------------------------------------- 1 | ; $Name:Wide$ 2 | ; $Name(ru):Широкая$ 3 | ; $Name(uk):Широка$ 4 | ; $Name(es):Amplio$ 5 | ; $Name(it):Ampio$ 6 | 7 | scr.w = 960 8 | scr.h = 540 9 | 10 | scr.gfx.bg = bg.png 11 | scr.col.bg = white 12 | 13 | win.align = justify 14 | win.x = 48 15 | win.y = 8 16 | win.w = 664 17 | win.h = 524 18 | 19 | inv.x = 780 20 | inv.y = 8 21 | inv.w = 144 22 | inv.h = 504 23 | 24 | win.fnt.size = 16 25 | win.fnt.height = 1.2 26 | 27 | inv.fnt.size = 16 28 | inv.fnt.height = 1.2 29 | 30 | menu.fnt.size = 16 31 | menu.fnt.height = 1.0 32 | 33 | menu.button.x = 936 34 | menu.button.y = 516 35 | --------------------------------------------------------------------------------