diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 3108e743..37e9a960 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v4 with: repository: libsdl-org/SDL - ref: release-2.30.8 + ref: release-2.28.5 path: 'SDL' - name: Build SDL @@ -73,7 +73,7 @@ jobs: sudo apt-get -y install ninja-build cd SDL ./build-scripts/android-prefab.sh - mvn install:install-file -Dfile=build-android-prefab/prefab-2.30.8/SDL2-2.30.8.aar -DpomFile=build-android-prefab/prefab-2.30.8/SDL2-2.30.8.pom + mvn install:install-file -Dfile=build-android-prefab/prefab-2.28.5/SDL2-2.28.5.aar -DpomFile=build-android-prefab/prefab-2.28.5/SDL2-2.28.5.pom - name: Build run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 446b49df..5339fd01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,14 +20,6 @@ on: - "third_party/**" - ".github/workflows/ci.yml" -permissions: - contents: read - statuses: write - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - env: SRC_DIR_PATH: desktop_version @@ -40,31 +32,19 @@ jobs: env: CXXFLAGS: -I/usr/local/include/SDL2 LDFLAGS: -L/usr/local/lib - HOMEBREW_NO_ENV_HINTS: 1 # Suppress brew update hints steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v1 with: submodules: true - - name: Cache Homebrew packages - id: cache-brew - uses: actions/cache@v3 - with: - path: | - /usr/local/Cellar/ninja - /usr/local/Cellar/sdl2 - /usr/local/opt/sdl2 # Symlink often used - key: ${{ runner.os }}-brew-${{ hashFiles('/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/ninja.rb', '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/sdl2.rb') }} # Using hash of formula files if available, or a fixed key for simplicity if not easily determined - - name: Install dependencies - if: steps.cache-brew.outputs.cache-hit != 'true' run: brew install ninja sdl2 - name: CMake configure (default version) run: | - mkdir -p ${SRC_DIR_PATH}/build && cd ${SRC_DIR_PATH}/build - cmake -G Ninja .. + mkdir ${SRC_DIR_PATH}/build && cd ${SRC_DIR_PATH}/build + cmake -GNinja .. - name: Build (default version) run: ninja -C ${SRC_DIR_PATH}/build @@ -84,36 +64,41 @@ jobs: run: ninja -C ${SRC_DIR_PATH}/build build-lin: - name: Build (Steam Linux Runtime Sniper) + name: Build (CentOS 7) runs-on: ubuntu-latest - container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest + container: ghcr.io/infoteddy/vvvvvv-build@sha256:50a2f769db3ca180286e9a76c1bf06b7016544a78e1fc7a9a0cc1144c675ced1 + + env: + CXXFLAGS: -I/usr/local/include/SDL2 + LDFLAGS: -L/usr/local/lib steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v1 with: submodules: true - name: CMake configure (default version) run: | - mkdir -p ${SRC_DIR_PATH}/build && cd ${SRC_DIR_PATH}/build - cmake -G Ninja .. + mkdir ${SRC_DIR_PATH}/build && cd ${SRC_DIR_PATH}/build + cmake .. - name: Build (default version) - run: ninja -C ${SRC_DIR_PATH}/build + run: make -j $(nproc) -C ${SRC_DIR_PATH}/build - name: CMake configure (official) run: | cd ${SRC_DIR_PATH}/build - cmake -G Ninja -DOFFICIAL_BUILD=ON .. + cmake -DOFFICIAL_BUILD=ON .. - name: Build (official) - run: ninja -C ${SRC_DIR_PATH}/build + run: | + make -j $(nproc) -C ${SRC_DIR_PATH}/build - name: CMake configure (M&P) run: | cd ${SRC_DIR_PATH}/build - cmake -G Ninja -DOFFICIAL_BUILD=OFF -DMAKEANDPLAY=ON .. + cmake -DOFFICIAL_BUILD=OFF -DMAKEANDPLAY=ON .. - name: Build (M&P) - run: ninja -C ${SRC_DIR_PATH}/build + run: make -j $(nproc) -C ${SRC_DIR_PATH}/build build-win: name: Build (windows-latest) @@ -121,10 +106,10 @@ jobs: runs-on: windows-latest env: - SDL_VERSION: 2.26.0 + SDL_VERSION: 2.24.0 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v1 with: submodules: true @@ -143,7 +128,19 @@ jobs: Invoke-WebRequest "https://github.com/libsdl-org/SDL/releases/download/release-$env:SDL_VERSION/SDL2-devel-$env:SDL_VERSION-VC.zip" -OutFile C:\SDL.zip Expand-Archive C:\SDL.zip -DestinationPath C:\ - - name: CMake initial configure/generate + - name: Cache build folder for this CMakeLists.txt + id: cache-windows-build-folder + uses: actions/cache@v3 + env: + cache-name: cache-windows-build-folder-VS2022 + with: + path: | + desktop_version/build + desktop_version/CMakeLists.txt + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('desktop_version/CMakeLists.txt') }}-SDL${{ env.SDL_VERSION }} + + - if: ${{ steps.cache-windows-build-folder.outputs.cache-hit != 'true' }} + name: CMake initial configure/generate run: | mkdir $env:SRC_DIR_PATH/build cd $env:SRC_DIR_PATH/build diff --git a/License exceptions.md b/License exceptions.md index fbc132f8..de233a32 100644 --- a/License exceptions.md +++ b/License exceptions.md @@ -21,6 +21,4 @@ Last updated on January 23rd, 2024. | Dreamcast Port | [Gustavo Aranda](https://github.com/gusarba/) | Port for the Sega Dreamcast. | Permission is given to distribute a ready-to-use CD image file for the Sega Dreamcast containing the data.zip assets for non commercial use only. | [github repo](https://github.com/gusarba/VVVVVVDC)| | XBox One/UWP Port | [tunip3](https://github.com/tunip3) | Port for XBOX ONE (DURANGO) via UWP. | Permission is given to distribute a pre-compiled package (containing the data.zip assets) for people to run on development mode xboxes, for non commercial use only. | [github repo](https://github.com/tunip3/DURANGO-V6)| | armhf Port | [johnnyonFlame](https://github.com/johnnyonFlame/) | Armhf port for Raspberry PI and other SBC devices| Permission is for non commercial use only. Display the following text in the readme to make it clear that this is an exception: "VVVVVV is a commercial game! The author has given special permission to make this port available for free. If you enjoy the game, please consider purchasing a copy at [thelettervsixtim.es](http://thelettervsixtim.es)."| [github release](https://github.com/JohnnyonFlame/VVVVVV/releases/tag/v2.4-r1) | -| PortMaster distributions of the game for Linux Handheld devices | [portmaster](https://portmaster.games/) | A port manager GUI for Linux handheld devices | Permission is for non commercial use only. Display the following text in the readme to make it clear that this is an exception: "VVVVVV is a commercial game! The author has given special permission to make this port available for free. If you enjoy the game, please consider purchasing a copy at [thelettervsixtim.es](http://thelettervsixtim.es)."| [website](https://portmaster.games/detail.html?name=vvvvvv) | | Wii Port | [Alberto Mardegan](https://github.com/mardy/) | Port for the Nintendo Wii. | Permission is given to distribute a ready-to-use build for the Nintendo Wii containing the data.zip assets for non commercial use only. | [github repo](https://github.com/mardy/VVVVVV/tree/wii) | -| Recalbox Port | [digitalLumberjack](https://gitlab.com/recalbox/recalbox) | Port for Recalbox project. | Display the following text in the readme to make it clear that this is an exception: "VVVVVV is a commercial game! The author has given special permission to make this port available for free. If you enjoy the game, please consider purchasing a copy at [thelettervsixtim.es](http://thelettervsixtim.es)." | [website](https://recalbox.com/) | diff --git a/README.md b/README.md index cdcbf441..477f218f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is the source code to VVVVVV, the 2010 indie game by [Terry Cavanagh](http: The source code for the desktop version is in [this folder](desktop_version). -VVVVVV is still commercially available at [thelettervsixtim.es](https://thelettervsixtim.es/) if you'd like to support it, but you are completely free to compile the game for your own personal use. If you're interested in distributing a compiled version of the game, see [LICENSE.md](LICENSE.md) for more information. +VVVVVV is still commerically available at [thelettervsixtim.es](https://thelettervsixtim.es/) if you'd like to support it, but you are completely free to compile the game for your own personal use. If you're interested in distributing a compiled version of the game, see [LICENSE.md](LICENSE.md) for more information. Discussion about VVVVVV updates mainly happens on the "unofficial" [VVVVVV discord](https://discord.gg/Zf7Nzea), in the `vvvvvv-code` channel. diff --git a/desktop_version/AppIcon.xcassets/AppIcon.appiconset/AppIcon.png b/desktop_version/AppIcon.xcassets/AppIcon.appiconset/AppIcon.png deleted file mode 100644 index 6b3a72b7..00000000 Binary files a/desktop_version/AppIcon.xcassets/AppIcon.appiconset/AppIcon.png and /dev/null differ diff --git a/desktop_version/AppIcon.xcassets/AppIcon.appiconset/Contents.json b/desktop_version/AppIcon.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index cefcc878..00000000 --- a/desktop_version/AppIcon.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "images" : [ - { - "filename" : "AppIcon.png", - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/desktop_version/AppIcon.xcassets/Contents.json b/desktop_version/AppIcon.xcassets/Contents.json deleted file mode 100644 index 73c00596..00000000 --- a/desktop_version/AppIcon.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt index 26d191d4..9e60db8b 100644 --- a/desktop_version/CMakeLists.txt +++ b/desktop_version/CMakeLists.txt @@ -25,7 +25,7 @@ option(REMOVE_ABSOLUTE_PATHS "If supported by the compiler, replace all absolute # Architecture Flags -if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") +if(APPLE) # Wow, Apple is a huge jerk these days huh? set(OSX_10_9_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk) if(NOT CMAKE_OSX_SYSROOT) @@ -38,8 +38,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) link_directories(/usr/local/lib) add_compile_options(-Werror=partial-availability) -elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") - set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0) # SDL goes back to iOS 8.0, but modern Xcode doesn't endif() project(VVVVVV) @@ -50,16 +48,12 @@ endif() # RPATH if(NOT WIN32) - if(CMAKE_SYSTEM_NAME STREQUAL "iOS") - set(BIN_LIBROOT "Frameworks") - set(BIN_RPATH "@executable_path/Frameworks") - elseif(APPLE) + if(APPLE) set(BIN_LIBROOT "osx") set(BIN_RPATH "@executable_path/osx") elseif(CMAKE_SIZEOF_VOID_P MATCHES "8") set(BIN_LIBROOT "lib64") set(BIN_RPATH "\$ORIGIN/lib64") - set(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags") else() set(BIN_LIBROOT "lib") set(BIN_RPATH "\$ORIGIN/lib") @@ -71,7 +65,7 @@ if(NOT WIN32) endif() # Source Lists -set(VVV_CXX_SRC +set(VVV_SRC src/BinaryBlob.cpp src/BlockV.cpp src/ButtonGlyphs.cpp @@ -88,7 +82,6 @@ set(VVV_CXX_SRC src/Graphics.cpp src/GraphicsResources.cpp src/GraphicsUtil.cpp - src/IMERender.cpp src/Input.cpp src/KeyPoll.cpp src/Labclass.cpp @@ -115,8 +108,6 @@ set(VVV_CXX_SRC src/WarpClass.cpp src/XMLUtils.cpp src/main.cpp -) -set(VVV_C_SRC src/DeferCallbacks.c src/GlitchrunnerMode.c src/Network.c @@ -129,46 +120,17 @@ set(VVV_C_SRC ../third_party/physfs/extras/physfsrwops.c ) if(STEAM) - list(APPEND VVV_C_SRC src/SteamNetwork.c) + list(APPEND VVV_SRC src/SteamNetwork.c) endif() if(GOG) - list(APPEND VVV_C_SRC src/GOGNetwork.c) + list(APPEND VVV_SRC src/GOGNetwork.c) endif() -if(CMAKE_SYSTEM_NAME STREQUAL "iOS") - list(APPEND VVV_C_SRC src/SDL_uikit_main.c) -endif() - -set(VVV_SRC ${VVV_CXX_SRC} ${VVV_C_SRC}) # Executable information if(WIN32) add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc) elseif(ANDROID) add_library(VVVVVV SHARED ${VVV_SRC}) -elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") - file(GLOB_RECURSE REPO_RESOURCES "fonts/*" "lang/*") - - add_executable(VVVVVV MACOSX_BUNDLE ${VVV_SRC} ${DATA_ZIP} AppIcon.xcassets ${REPO_RESOURCES}) - set_target_properties(VVVVVV PROPERTIES - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.distractionware.vvvvvvmobile" - XCODE_ATTRIBUTE_PRODUCT_NAME "VVVVVV" - XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" # iPhone, iPad - XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "2.5" - XCODE_ATTRIBUTE_MARKETING_VERSION "2.5" - XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon - XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE YES - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist" - XCODE_ATTRIBUTE_INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace YES - XCODE_ATTRIBUTE_INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents YES - RESOURCE "${DATA_ZIP};AppIcon.xcassets" - ) - - foreach(REPO_FILE ${REPO_RESOURCES}) - file(RELATIVE_PATH REPO_FILE_REL "${CMAKE_CURRENT_SOURCE_DIR}" ${REPO_FILE}) - get_filename_component(REPO_FILE_DIR ${REPO_FILE_REL} DIRECTORY) - set_property(SOURCE ${REPO_FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${REPO_FILE_DIR}") - source_group("Resources/${REPO_FILE_DIR}" FILES "${REPO_FILE}") - endforeach() else() add_executable(VVVVVV ${VVV_SRC}) endif() @@ -246,26 +208,35 @@ set(SBIDI_SRC ../third_party/SheenBidi/Source/SheenBidi.c) if(NOT OFFICIAL_BUILD) # Add interim commit hash and its date to the build - # These filenames have to be qualified, because when we run - # the CMake script, its work dir gets set to the build folder - set(VERSION_INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.in.c) - set(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.out.c) + # find_package sets GIT_FOUND and GIT_EXECUTABLE + find_package(Git) - add_custom_command( - # This OUTPUT line is required for this to be ran every time - OUTPUT ${VERSION_OUTPUT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/src/_dummy.c - COMMAND ${CMAKE_COMMAND} - # These args have to be passed through, otherwise the script can't see them - # Also, these args have to come BEFORE `-P`! (Otherwise it fails with an unclear error) - -DINPUT_FILE=${VERSION_INPUT_FILE} - -DOUTPUT_FILE=${VERSION_OUTPUT_FILE} - -P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake - ) + if(GIT_FOUND) + # These filenames have to be qualified, because when we run + # the CMake script, its work dir gets set to the build folder + set(VERSION_INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.in.c) + set(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.out.c) - target_compile_definitions(VVVVVV PRIVATE -DINTERIM_VERSION_EXISTS) + add_custom_target( + GenerateVersion ALL + # This BYPRODUCTS line is required for this to be ran every time + BYPRODUCTS ${VERSION_OUTPUT_FILE} + COMMAND ${CMAKE_COMMAND} + # These args have to be passed through, otherwise the script can't see them + # Also, these args have to come BEFORE `-P`! (Otherwise it fails with an unclear error) + -DGIT_EXECUTABLE=${GIT_EXECUTABLE} + -DINPUT_FILE=${VERSION_INPUT_FILE} + -DOUTPUT_FILE=${VERSION_OUTPUT_FILE} + -P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake + ) - add_library(InterimVersion STATIC src/InterimVersion.out.c) - list(APPEND STATIC_LIBRARIES InterimVersion) + add_dependencies(VVVVVV GenerateVersion) + + target_compile_definitions(VVVVVV PRIVATE -DINTERIM_VERSION_EXISTS) + + add_library(InterimVersion STATIC src/InterimVersion.out.c) + list(APPEND STATIC_LIBRARIES InterimVersion) + endif() endif() # Build options @@ -313,32 +284,30 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(VVVVVV PRIVATE -Wno-c99-extensions) endif() -# Set standards version, disable exceptions and RTTI if(MSVC) # MSVC doesn't have /std:c99 or /std:c++98 switches! - # MSVC does not officially support disabling exceptions, - # so this is as far as we are willing to go to disable them. + # Disable exceptions string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS "/EHsc /GR-") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") - if(MSVC_VERSION GREATER 1900) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8") - endif() + # Disable RTTI + string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-") else() string(REGEX REPLACE "-std=[a-z0-9]+" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set_source_files_properties(${VVV_C_SRC} PROPERTIES COMPILE_FLAGS -std=c99) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") string(REGEX REPLACE "-std=[a-z0-9+]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS "-std=c++98 -fno-exceptions -fno-rtti") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") - # Dependencies (as needed) - set_source_files_properties(${FAUDIO_SRC} PROPERTIES COMPILE_FLAGS -std=c99) - set_source_files_properties(${CHM_SRC} PROPERTIES COMPILE_FLAGS -std=c99) + # Disable exceptions + string(REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") + + # Disable RTTI + string(REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") endif() # Unfortunately, it doesn't seem like distros package LodePNG @@ -452,15 +421,6 @@ elseif (EMSCRIPTEN) target_compile_options(faudio-static PUBLIC -sUSE_SDL=2) target_link_libraries(faudio-static -sUSE_SDL=2) endif() -elseif(DEFINED SDL2_FRAMEWORK) - message(STATUS "Using pre-defined SDL2 variable SDL2_FRAMEWORK") - target_include_directories(VVVVVV SYSTEM PRIVATE "$") - target_link_libraries(VVVVVV ${SDL2_FRAMEWORK}) - if(BUNDLE_DEPENDENCIES) - target_include_directories(faudio-static SYSTEM PRIVATE "$") - target_link_libraries(faudio-static ${SDL2_FRAMEWORK}) - endif() - set_target_properties(VVVVVV PROPERTIES XCODE_EMBED_FRAMEWORKS ${SDL2_FRAMEWORK}) else() # Only try to autodetect if both SDL2 variables aren't explicitly set find_package(SDL2 CONFIG) diff --git a/desktop_version/CONTRIBUTORS.txt b/desktop_version/CONTRIBUTORS.txt index 06930690..4c4896c7 100644 --- a/desktop_version/CONTRIBUTORS.txt +++ b/desktop_version/CONTRIBUTORS.txt @@ -20,7 +20,7 @@ Contributors * Jules de Sartiges (@strikersh) * Keith Stellyes (@keithstellyes) * KyoZM (@lsaa) -* leo vriska (@leo60228) +* leo60228 (@leo60228) * MAO3J1m0Op (@MAO3J1m0Op) * Malte Grimm (@trelbutate) * Marvin Scholz (@ePirat) diff --git a/desktop_version/Info.plist b/desktop_version/Info.plist deleted file mode 100644 index ff579a6c..00000000 --- a/desktop_version/Info.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - UIFileSharingEnabled - - - diff --git a/desktop_version/VVVVVV-android/README.md b/desktop_version/VVVVVV-android/README.md index b7305828..46b6d401 100644 --- a/desktop_version/VVVVVV-android/README.md +++ b/desktop_version/VVVVVV-android/README.md @@ -10,18 +10,18 @@ How to Build ------------ The recommended way is to install Android Studio and Maven. These instructions are for -SDL 2.30.8; adapt your SDL version accordingly. +SDL 2.28.5; adapt your SDL version accordingly. 1. Place a copy of `data.zip` in `desktop_version/VVVVVV-android/app/src/main/assets/`. (If the `assets/` folder doesn't exist, then create it.) -2. Obtain the SDL 2.30.8 Maven package. As of writing, SDL currently does not publish +2. Obtain the SDL 2.28.5 Maven package. As of writing, SDL currently does not publish Maven packages, so here is one way to obtain them (other methods are possible): - 1. Download the SDL 2.30.8 source code. + 1. Download the SDL 2.28.5 source code. 2. Run the `build-scripts/android-prefab.sh` script in the SDL repository. 3. After building, run `mvn install:install-file - -Dfile=build-android-prefab/prefab-2.30.8/SDL2-2.30.8.aar - -DpomFile=build-android-prefab/prefab-2.30.8/SDL2-2.30.8.pom` to install it to + -Dfile=build-android-prefab/prefab-2.28.5/SDL2-2.28.5.aar + -DpomFile=build-android-prefab/prefab-2.28.5/SDL2-2.28.5.pom` to install it to Maven Local. 3. Open the `desktop_version/VVVVVV-android/` folder in Android Studio. diff --git a/desktop_version/VVVVVV-android/app/build.gradle b/desktop_version/VVVVVV-android/app/build.gradle index 58692135..7eaecbdd 100644 --- a/desktop_version/VVVVVV-android/app/build.gradle +++ b/desktop_version/VVVVVV-android/app/build.gradle @@ -14,8 +14,8 @@ android { defaultConfig { minSdkVersion 29 targetSdkVersion 34 - versionCode 20005000 - versionName "2.5" + versionCode 20004000 + versionName "2.4" applicationId "air.com.distractionware.vvvvvvmobile" externalNativeBuild { cmake { @@ -110,5 +110,5 @@ dependencies { implementation 'org.jetbrains:annotations:15.0' implementation 'androidx.core:core:1.10.1' implementation 'androidx.exifinterface:exifinterface:1.3.6' - implementation 'org.libsdl.android:SDL2:2.30.8' + implementation 'org.libsdl.android:SDL2:2.28.5' } diff --git a/desktop_version/fonts/font_ar.fontmeta b/desktop_version/fonts/font_ar.fontmeta index 0f6c09df..ba5d788b 100644 --- a/desktop_version/fonts/font_ar.fontmeta +++ b/desktop_version/fonts/font_ar.fontmeta @@ -1,6 +1,6 @@ - العربية/فارسی + العربية 8 10 1 @@ -10,7 +10,6 @@ - diff --git a/desktop_version/fonts/font_ar.png b/desktop_version/fonts/font_ar.png index 3e6e8d79..3d02abc3 100644 Binary files a/desktop_version/fonts/font_ar.png and b/desktop_version/fonts/font_ar.png differ diff --git a/desktop_version/lang/README-programmers.txt b/desktop_version/lang/README-programmers.txt index 71260a59..d0388b44 100644 --- a/desktop_version/lang/README-programmers.txt +++ b/desktop_version/lang/README-programmers.txt @@ -58,7 +58,7 @@ Of course, when you remove strings without replacement, you can simply remove th These are the text printing functions: font::print(flags, x, y, text, r, g, b) - font::print_wrap(flags, x, y, text, r, g, b, linespacing = -1, maxwidth = -1) + font::print(flags, x, y, text, r, g, b, linespacing = -1, maxwidth = -1) The flags argument can be 0, or a set of flags that do things like centering, enlarging, etc. diff --git a/desktop_version/lang/ar/strings.xml b/desktop_version/lang/ar/strings.xml index e2dd70db..dc4ab172 100644 --- a/desktop_version/lang/ar/strings.xml +++ b/desktop_version/lang/ar/strings.xml @@ -46,8 +46,10 @@ + + @@ -137,30 +139,19 @@ - - - - - - - - - - - @@ -233,7 +224,6 @@ - @@ -246,11 +236,6 @@ - - - - - - @@ -673,7 +657,7 @@ - + @@ -788,7 +772,7 @@ You have found the secret lab!" translation="تهانينا! - + @@ -810,10 +794,9 @@ You have found the secret lab!" translation="تهانينا! - - - - + + + diff --git a/desktop_version/lang/ca/strings.xml b/desktop_version/lang/ca/strings.xml index 29d89131..9067a50d 100644 --- a/desktop_version/lang/ca/strings.xml +++ b/desktop_version/lang/ca/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ Has trobat el laboratori secret!" explanation="" max="34*4"/> - + @@ -802,10 +786,9 @@ Has trobat el laboratori secret!" explanation="" max="34*4"/> - - - - + + + diff --git a/desktop_version/lang/cy/strings.xml b/desktop_version/lang/cy/strings.xml index d9aa1816..75233e0a 100644 --- a/desktop_version/lang/cy/strings.xml +++ b/desktop_version/lang/cy/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - + - - - - + - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -296,7 +281,7 @@ - + @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ Rwyt ti wedi dod o hyd i'r labordy cyfrinachol!" explanation="" max="34*4"/ - + @@ -802,10 +786,9 @@ Rwyt ti wedi dod o hyd i'r labordy cyfrinachol!" explanation="" max="34*4"/ - - - - + + + diff --git a/desktop_version/lang/de/strings.xml b/desktop_version/lang/de/strings.xml index 979aaad6..8bc440f8 100644 --- a/desktop_version/lang/de/strings.xml +++ b/desktop_version/lang/de/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ Du hast das Geheimlabor gefunden!" explanation="" max="34*4"/> - + @@ -802,10 +786,9 @@ Du hast das Geheimlabor gefunden!" explanation="" max="34*4"/> - - - - + + + diff --git a/desktop_version/lang/en/strings.xml b/desktop_version/lang/en/strings.xml index 45154fc9..86a4217f 100644 --- a/desktop_version/lang/en/strings.xml +++ b/desktop_version/lang/en/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -637,7 +622,6 @@ - @@ -799,7 +783,6 @@ You have found the secret lab!" translation="" explanation="" max="34*4"/> - diff --git a/desktop_version/lang/eo/strings.xml b/desktop_version/lang/eo/strings.xml index 735fe1e7..6c085043 100644 --- a/desktop_version/lang/eo/strings.xml +++ b/desktop_version/lang/eo/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -466,7 +451,7 @@ - + @@ -637,7 +622,6 @@ - @@ -805,7 +789,6 @@ Vi trovis la sekretan labon!" explanation="" max="34*4"/> - diff --git a/desktop_version/lang/es/strings.xml b/desktop_version/lang/es/strings.xml index 4ad7b06c..68c8a246 100644 --- a/desktop_version/lang/es/strings.xml +++ b/desktop_version/lang/es/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -637,7 +622,6 @@ - @@ -805,7 +789,6 @@ You have found the secret lab!" translation="¡Enhorabuena! - diff --git a/desktop_version/lang/es_419/strings.xml b/desktop_version/lang/es_419/strings.xml index 5c316b44..827a3b97 100644 --- a/desktop_version/lang/es_419/strings.xml +++ b/desktop_version/lang/es_419/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -637,7 +622,6 @@ - @@ -805,7 +789,6 @@ You have found the secret lab!" translation="¡Felicitaciones! - diff --git a/desktop_version/lang/es_AR/strings.xml b/desktop_version/lang/es_AR/strings.xml index 66d225b2..e2cdc457 100644 --- a/desktop_version/lang/es_AR/strings.xml +++ b/desktop_version/lang/es_AR/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -637,7 +622,6 @@ - @@ -805,7 +789,6 @@ You have found the secret lab!" translation="¡Felicitaciones! - diff --git a/desktop_version/lang/fa/cutscenes.xml b/desktop_version/lang/fa/cutscenes.xml deleted file mode 100644 index 0bae1ffd..00000000 --- a/desktop_version/lang/fa/cutscenes.xml +++ /dev/null @@ -1,944 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/desktop_version/lang/fa/graphics/flipsprites.png b/desktop_version/lang/fa/graphics/flipsprites.png deleted file mode 100644 index d8c893e0..00000000 Binary files a/desktop_version/lang/fa/graphics/flipsprites.png and /dev/null differ diff --git a/desktop_version/lang/fa/graphics/sprites.png b/desktop_version/lang/fa/graphics/sprites.png deleted file mode 100644 index e8d9f564..00000000 Binary files a/desktop_version/lang/fa/graphics/sprites.png and /dev/null differ diff --git a/desktop_version/lang/fa/graphics/spritesmask.xml b/desktop_version/lang/fa/graphics/spritesmask.xml deleted file mode 100644 index 57b33a7e..00000000 --- a/desktop_version/lang/fa/graphics/spritesmask.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/desktop_version/lang/fa/meta.xml b/desktop_version/lang/fa/meta.xml deleted file mode 100644 index 1ee34692..00000000 --- a/desktop_version/lang/fa/meta.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - 1 - - - فارسی - - - Persian Localization: Amir Arzani & Masoud Varaste - - - برای انتخاب روی اسپیس، Z، یا V بزن - - - برای انتخاب روی {button} بزن - - - 1 - - - 1 - - - 0 - - - 0 - - - 1 - - - [ {label} ] - [{label}] - - - font_ar - diff --git a/desktop_version/lang/fa/numbers.xml b/desktop_version/lang/fa/numbers.xml deleted file mode 100644 index 705ecdce..00000000 --- a/desktop_version/lang/fa/numbers.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/desktop_version/lang/fa/roomnames.xml b/desktop_version/lang/fa/roomnames.xml deleted file mode 100644 index e7fdc0a8..00000000 --- a/desktop_version/lang/fa/roomnames.xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/desktop_version/lang/fa/roomnames_special.xml b/desktop_version/lang/fa/roomnames_special.xml deleted file mode 100644 index 0bdf5cfa..00000000 --- a/desktop_version/lang/fa/roomnames_special.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/desktop_version/lang/fa/strings.xml b/desktop_version/lang/fa/strings.xml deleted file mode 100644 index d81835a8..00000000 --- a/desktop_version/lang/fa/strings.xml +++ /dev/null @@ -1,811 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/desktop_version/lang/fa/strings_plural.xml b/desktop_version/lang/fa/strings_plural.xml deleted file mode 100644 index 4dff7b4f..00000000 --- a/desktop_version/lang/fa/strings_plural.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/desktop_version/lang/fr/strings.xml b/desktop_version/lang/fr/strings.xml index 8cfd849f..411cc564 100644 --- a/desktop_version/lang/fr/strings.xml +++ b/desktop_version/lang/fr/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -546,7 +531,7 @@ - + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ Vous avez trouvé le labo secret !" explanation="" max="34*4"/> - + @@ -802,10 +786,9 @@ Vous avez trouvé le labo secret !" explanation="" max="34*4"/> - - - - + + + diff --git a/desktop_version/lang/ga/strings.xml b/desktop_version/lang/ga/strings.xml index 625d9d6e..cbdf9987 100644 --- a/desktop_version/lang/ga/strings.xml +++ b/desktop_version/lang/ga/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -230,7 +221,6 @@ Déan cóip chúltaca, ar eagla na heagla." explanation="translation maintenance - @@ -243,11 +233,6 @@ Déan cóip chúltaca, ar eagla na heagla." explanation="translation maintenance - - - - - @@ -333,9 +318,9 @@ Déan cóip chúltaca, ar eagla na heagla." explanation="translation maintenance - - - + + + @@ -453,8 +438,8 @@ Déan cóip chúltaca, ar eagla na heagla." explanation="translation maintenance - - + + @@ -609,7 +594,7 @@ Déan cóip chúltaca, ar eagla na heagla." explanation="translation maintenance - + @@ -639,7 +624,6 @@ Déan cóip chúltaca, ar eagla na heagla." explanation="translation maintenance - @@ -656,7 +640,7 @@ Déan cóip chúltaca, ar eagla na heagla." explanation="translation maintenance - + @@ -695,7 +679,7 @@ Fuair tú ornáid lonrach!" explanation="" max="34*4"/> You have found a lost crewmate!" translation="Comhghairdeas! -Fuair tú loingseoir a bhí ar strae!" explanation="" max="34*4"/> +Fuair tú leathbhádóir a bhí ar strae!" explanation="" max="34*4"/> - + - + @@ -782,7 +766,7 @@ Fuair tú an tsaotharlann rúnda!" explanation="" max="34*4"/> - + @@ -804,10 +788,9 @@ Fuair tú an tsaotharlann rúnda!" explanation="" max="34*4"/> - - - - + + + diff --git a/desktop_version/lang/it/strings.xml b/desktop_version/lang/it/strings.xml index 5075f520..f4798b2b 100644 --- a/desktop_version/lang/it/strings.xml +++ b/desktop_version/lang/it/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ Hai trovato il laboratorio segreto!" explanation="" max="34*4"/> - + @@ -802,10 +786,9 @@ Hai trovato il laboratorio segreto!" explanation="" max="34*4"/> - - - - + + + diff --git a/desktop_version/lang/ja/strings.xml b/desktop_version/lang/ja/strings.xml index 166d1b58..f7fe0042 100644 --- a/desktop_version/lang/ja/strings.xml +++ b/desktop_version/lang/ja/strings.xml @@ -47,7 +47,9 @@ + + @@ -140,30 +142,19 @@ OFFにしますか?" explanation="" max="38*6" max_local="38*5"/> - - - - - - - - - - - @@ -243,7 +234,6 @@ Escキーを押すと表示を終了する。" explanation="" max="38*6" max_loc - @@ -256,11 +246,6 @@ Escキーを押すと表示を終了する。" explanation="" max="38*6" max_loc - - - - - @@ -673,7 +658,6 @@ Steam Deckには対応していません。" explanation="" max="38*5" max_local - @@ -871,7 +855,6 @@ You have found the secret lab!" translation="よくやった! - diff --git a/desktop_version/lang/ko/strings.xml b/desktop_version/lang/ko/strings.xml index 9d47d4ec..e7b69f1f 100755 --- a/desktop_version/lang/ko/strings.xml +++ b/desktop_version/lang/ko/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ You have found the secret lab!" translation="축하합니다! - + @@ -802,10 +786,9 @@ You have found the secret lab!" translation="축하합니다! - - - - + + + diff --git a/desktop_version/lang/nl/strings.xml b/desktop_version/lang/nl/strings.xml index 4dd6a972..6d1aeebc 100644 --- a/desktop_version/lang/nl/strings.xml +++ b/desktop_version/lang/nl/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -637,7 +622,6 @@ - @@ -806,7 +790,6 @@ Je hebt het geheime lab gevonden!" explanation="" max="34*4"/> - diff --git a/desktop_version/lang/pl/strings.xml b/desktop_version/lang/pl/strings.xml index c0c44798..059bd1ed 100644 --- a/desktop_version/lang/pl/strings.xml +++ b/desktop_version/lang/pl/strings.xml @@ -46,7 +46,9 @@ + + @@ -122,7 +124,7 @@ - + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,32 +764,31 @@ Znaleziono tajne laboratorium!" explanation="" max="34*4"/> - + - + - + - - - + + + - + - - - - - - - + + + + + + diff --git a/desktop_version/lang/pt_BR/strings.xml b/desktop_version/lang/pt_BR/strings.xml index 1a01283f..0d084ab8 100644 --- a/desktop_version/lang/pt_BR/strings.xml +++ b/desktop_version/lang/pt_BR/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -637,7 +622,6 @@ - @@ -805,7 +789,6 @@ Você encontrou o laboratório secreto!" explanation="" max="34*4"/> - diff --git a/desktop_version/lang/pt_PT/strings.xml b/desktop_version/lang/pt_PT/strings.xml index 3d009543..3d24a84f 100644 --- a/desktop_version/lang/pt_PT/strings.xml +++ b/desktop_version/lang/pt_PT/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ Encontraste o laboratório secreto!" explanation="" max="34*4"/> - + @@ -802,10 +786,9 @@ Encontraste o laboratório secreto!" explanation="" max="34*4"/> - - - - + + + diff --git a/desktop_version/lang/ru/strings.xml b/desktop_version/lang/ru/strings.xml index d412935e..04c6476b 100644 --- a/desktop_version/lang/ru/strings.xml +++ b/desktop_version/lang/ru/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -662,7 +647,6 @@ - @@ -805,7 +789,7 @@ You have found the secret lab!" translation="Поздравляем! - + @@ -827,10 +811,9 @@ You have found the secret lab!" translation="Поздравляем! - - - - + + + diff --git a/desktop_version/lang/szl/meta.xml b/desktop_version/lang/szl/meta.xml index fae781f1..23366352 100644 --- a/desktop_version/lang/szl/meta.xml +++ b/desktop_version/lang/szl/meta.xml @@ -3,7 +3,7 @@ 1 - ślōnsko gŏdka + ślonsko godka Ślōnski przekłŏd: Kuba Kallus diff --git a/desktop_version/lang/szl/strings.xml b/desktop_version/lang/szl/strings.xml index df9585b3..3eadda25 100644 --- a/desktop_version/lang/szl/strings.xml +++ b/desktop_version/lang/szl/strings.xml @@ -46,7 +46,9 @@ + + @@ -122,7 +124,7 @@ - + @@ -132,31 +134,20 @@ - - - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ Wysznupano tajne laboratoriōm!" explanation="" max="34*4"/> - + @@ -803,9 +787,8 @@ Wysznupano tajne laboratoriōm!" explanation="" max="34*4"/> - - - + + diff --git a/desktop_version/lang/tr/strings.xml b/desktop_version/lang/tr/strings.xml index 5a8817f5..c7cfdf82 100644 --- a/desktop_version/lang/tr/strings.xml +++ b/desktop_version/lang/tr/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ Gizli laboratuvarı buldun!" explanation="" max="34*4"/> - + @@ -802,10 +786,9 @@ Gizli laboratuvarı buldun!" explanation="" max="34*4"/> - - - - + + + diff --git a/desktop_version/lang/uk/strings.xml b/desktop_version/lang/uk/strings.xml index 75ec7058..dbfc81a9 100644 --- a/desktop_version/lang/uk/strings.xml +++ b/desktop_version/lang/uk/strings.xml @@ -46,7 +46,9 @@ + + @@ -133,30 +135,19 @@ - - - - - - - - - - - @@ -229,7 +220,6 @@ - @@ -242,11 +232,6 @@ - - - - - @@ -332,9 +317,9 @@ - - - + + + @@ -451,8 +436,8 @@ - - + + @@ -637,7 +622,6 @@ - @@ -780,7 +764,7 @@ You have found the secret lab!" translation="Поздоровляємо! - + @@ -802,10 +786,9 @@ You have found the secret lab!" translation="Поздоровляємо! - - - - + + + diff --git a/desktop_version/lang/zh/strings.xml b/desktop_version/lang/zh/strings.xml index 1487c97c..d437c5ba 100644 --- a/desktop_version/lang/zh/strings.xml +++ b/desktop_version/lang/zh/strings.xml @@ -46,7 +46,9 @@ + + @@ -134,30 +136,19 @@ - - - - - - - - - - - @@ -235,7 +226,6 @@ - @@ -248,11 +238,6 @@ - - - - - @@ -339,9 +324,9 @@ - - - + + + @@ -461,8 +446,8 @@ - - + + @@ -647,7 +632,6 @@ - @@ -790,7 +774,7 @@ You have found the secret lab!" translation="恭喜你! - + @@ -812,10 +796,9 @@ You have found the secret lab!" translation="恭喜你! - - - - + + + diff --git a/desktop_version/lang/zh_TW/strings.xml b/desktop_version/lang/zh_TW/strings.xml index cb176772..157c0cba 100644 --- a/desktop_version/lang/zh_TW/strings.xml +++ b/desktop_version/lang/zh_TW/strings.xml @@ -46,7 +46,9 @@ + + @@ -134,30 +136,19 @@ - - - - - - - - - - - @@ -235,7 +226,6 @@ - @@ -248,11 +238,6 @@ - - - - - @@ -339,9 +324,9 @@ - - - + + + @@ -461,8 +446,8 @@ - - + + @@ -647,7 +632,6 @@ - @@ -790,7 +774,7 @@ You have found the secret lab!" translation="恭喜你! - + @@ -812,10 +796,9 @@ You have found the secret lab!" translation="恭喜你! - - - - + + + diff --git a/desktop_version/src/ButtonGlyphs.cpp b/desktop_version/src/ButtonGlyphs.cpp index 82610025..53171708 100644 --- a/desktop_version/src/ButtonGlyphs.cpp +++ b/desktop_version/src/ButtonGlyphs.cpp @@ -178,7 +178,7 @@ bool BUTTONGLYPHS_keyboard_is_available(void) return true; } -#if defined(__ANDROID__) || TARGET_OS_IPHONE +#ifdef __ANDROID__ return false; #else return !SDL_GetHintBoolean("SteamDeck", SDL_FALSE); @@ -272,9 +272,9 @@ const char* BUTTONGLYPHS_get_wasd_text(void) return loc::gettext("Press left/right to move"); } -const char* BUTTONGLYPHS_sdlbutton_to_glyph(const SDL_GameControllerButton button) +static const char* sdlbutton_to_glyph(const SDL_GameControllerButton button) { - if (button < 0 || button > SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) + if (button > SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) { SDL_assert(0 && "Unhandled button!"); return glyph[GLYPH_UNKNOWN]; @@ -292,7 +292,7 @@ static const char* glyph_for_vector( return NULL; } - return BUTTONGLYPHS_sdlbutton_to_glyph(buttons[index]); + return sdlbutton_to_glyph(buttons[index]); } const char* BUTTONGLYPHS_get_button(const ActionSet actionset, const Action action, int binding) diff --git a/desktop_version/src/ButtonGlyphs.h b/desktop_version/src/ButtonGlyphs.h index 78416117..bef8f805 100644 --- a/desktop_version/src/ButtonGlyphs.h +++ b/desktop_version/src/ButtonGlyphs.h @@ -20,7 +20,6 @@ void BUTTONGLYPHS_keyboard_set_active(bool active); void BUTTONGLYPHS_update_layout(SDL_GameController *c); const char* BUTTONGLYPHS_get_wasd_text(void); -const char* BUTTONGLYPHS_sdlbutton_to_glyph(SDL_GameControllerButton button); const char* BUTTONGLYPHS_get_button(ActionSet actionset, Action action, int binding); char* BUTTONGLYPHS_get_all_gamepad_buttons( diff --git a/desktop_version/src/Credits.h b/desktop_version/src/Credits.h index a6c6f630..37b30529 100644 --- a/desktop_version/src/Credits.h +++ b/desktop_version/src/Credits.h @@ -28,9 +28,6 @@ static const char* translators[] = { "Spanish (ARG.)", " LocQuest", " Guido Di Carlo", - "Persian", - " Amir Arzani", - " Masoud Varaste", "French", " Words of Magic", "Irish", @@ -77,7 +74,7 @@ static const char* translators[] = { }; /* Hardcoded pagesizes for the translator credits. Simplifies paging backwards and forwards */ -static const int translator_pagesize[] = { 6, 6, 12, 12, 10, 11, 10 }; +static const int translator_pagesize[] = { 6, 6, 9, 12, 10, 11, 10 }; /* Terry's Patrons... */ static const char* superpatrons[] = { @@ -176,7 +173,7 @@ static const char* githubfriends[] = { "Jules de Sartiges", "Keith Stellyes", "KyoZM", - "leo vriska", + "leo60228", "MAO3J1m0Op", "Malte Grimm", "Marvin Scholz", diff --git a/desktop_version/src/CustomLevels.cpp b/desktop_version/src/CustomLevels.cpp index 58365528..2a7494cf 100644 --- a/desktop_version/src/CustomLevels.cpp +++ b/desktop_version/src/CustomLevels.cpp @@ -57,7 +57,6 @@ RoomProperty::RoomProperty(void) enemyx2=320; enemyy2=240; enemytype=0; - enemyv=0; directmode=0; } @@ -252,23 +251,6 @@ static void levelMetaDataCallback(const char* filename) } } -static void unloadZips(void) -{ - char** list = PHYSFS_getSearchPath(); - if (list == NULL) - { - return; - } - for (char** path = list; *path != NULL; path++) - { - if (SDL_strncmp(*path, "levels/", 7) == 0 && endsWith(*path, ".zip")) - { - PHYSFS_unmount(*path); - } - } - PHYSFS_freeList(list); -} - void customlevelclass::getDirectoryData(void) { @@ -276,8 +258,6 @@ void customlevelclass::getDirectoryData(void) FILESYSTEM_clearLevelDirError(); - unloadZips(); - loadZips(); FILESYSTEM_enumerateLevelDirFileNames(levelMetaDataCallback); @@ -390,7 +370,6 @@ void customlevelclass::reset(void) roomproperties[i+(j*maxwidth)].enemyx2=320; roomproperties[i+(j*maxwidth)].enemyy2=240; roomproperties[i+(j*maxwidth)].enemytype=0; - roomproperties[i+(j*maxwidth)].enemyv=0; roomproperties[i+(j*maxwidth)].directmode=0; } } @@ -404,8 +383,6 @@ void customlevelclass::reset(void) script.textbox_colours.clear(); script.add_default_colours(); map.specialroomnames.clear(); - - player_colour = 0; } const int* customlevelclass::loadlevel( int rxi, int ryi ) @@ -1268,7 +1245,6 @@ bool customlevelclass::load(std::string _path) edLevelClassElement->QueryIntAttribute("enemyx2", &roomproperties[i].enemyx2); edLevelClassElement->QueryIntAttribute("enemyy2", &roomproperties[i].enemyy2); edLevelClassElement->QueryIntAttribute("enemytype", &roomproperties[i].enemytype); - edLevelClassElement->QueryIntAttribute("enemyv", &roomproperties[i].enemyv); edLevelClassElement->QueryIntAttribute("directmode", &roomproperties[i].directmode); edLevelClassElement->QueryIntAttribute("warpdir", &roomproperties[i].warpdir); @@ -1416,12 +1392,6 @@ next: map.specialroomnames.push_back(name); } } - - if (SDL_strcmp(pKey, "PlayerColour") == 0) - { - player_colour = help.Int(pText); - game.savecolour = player_colour; - } } if (mapwidth < maxwidth) @@ -1656,7 +1626,6 @@ bool customlevelclass::save(const std::string& _path) roompropertyElement->SetAttribute( "enemyx2", roomproperties[i].enemyx2); roompropertyElement->SetAttribute( "enemyy2", roomproperties[i].enemyy2); roompropertyElement->SetAttribute( "enemytype", roomproperties[i].enemytype); - roompropertyElement->SetAttribute( "enemyv", roomproperties[i].enemyv); roompropertyElement->SetAttribute( "directmode", roomproperties[i].directmode); roompropertyElement->SetAttribute( "warpdir", roomproperties[i].warpdir); @@ -1685,27 +1654,40 @@ bool customlevelclass::save(const std::string& _path) } xml::update_tag(data, "script", scriptString.c_str()); - - if (player_colour != 0) - { - xml::update_tag(data, "PlayerColour", player_colour); - } - else - { - // Get rid of this one as well, since older levels don't have this property anyways - tinyxml2::XMLElement* element; - while ((element = data->FirstChildElement("PlayerColour")) != NULL) - { - doc.DeleteNode(element); - } - } - return FILESYSTEM_saveTiXml2Document(newpath.c_str(), doc); } void customlevelclass::generatecustomminimap(void) { - const MapRenderData data = map.get_render_data(); + map.customzoom = 1; + if (mapwidth <= 10 && mapheight <= 10) + { + map.customzoom = 2; + } + if (mapwidth <= 5 && mapheight <= 5) + { + map.customzoom = 4; + } + + // Set minimap offsets + switch (map.customzoom) + { + case 4: + map.custommmxoff = 24 * (5 - mapwidth); + map.custommmyoff = 18 * (5 - mapheight); + break; + case 2: + map.custommmxoff = 12 * (10 - mapwidth); + map.custommmyoff = 9 * (10 - mapheight); + break; + default: + map.custommmxoff = 6 * (20 - mapwidth); + map.custommmyoff = int(4.5 * (20 - mapheight)); + break; + } + + map.custommmxsize = 240 - (map.custommmxoff * 2); + map.custommmysize = 180 - (map.custommmyoff * 2); // Start drawing the minimap @@ -1714,9 +1696,9 @@ void customlevelclass::generatecustomminimap(void) graphics.clear(); // Scan over the map size - for (int j2 = data.starty; j2 < data.starty + data.height; j2++) + for (int j2 = 0; j2 < mapheight; j2++) { - for (int i2 = data.startx; i2 < data.startx + data.width; i2++) + for (int i2 = 0; i2 < mapwidth; i2++) { std::vector dark_points; std::vector light_points; @@ -1724,12 +1706,12 @@ void customlevelclass::generatecustomminimap(void) bool dark = getroomprop(i2, j2)->tileset == 1; // Ok, now scan over each square - for (int j = 0; j < 9 * data.zoom; j++) + for (int j = 0; j < 9 * map.customzoom; j++) { - for (int i = 0; i < 12 * data.zoom; i++) + for (int i = 0; i < 12 * map.customzoom; i++) { int tile; - switch (data.zoom) + switch (map.customzoom) { case 4: tile = absfree( @@ -1754,7 +1736,7 @@ void customlevelclass::generatecustomminimap(void) if (tile >= 1) { // Add this pixel - SDL_Point point = { ((i2 - data.startx) * 12 * data.zoom) + i, ((j2 - data.starty) * 9 * data.zoom) + j }; + SDL_Point point = { (i2 * 12 * map.customzoom) + i, (j2 * 9 * map.customzoom) + j }; if (dark) { dark_points.push_back(point); diff --git a/desktop_version/src/CustomLevels.h b/desktop_version/src/CustomLevels.h index 22285182..97e3448d 100644 --- a/desktop_version/src/CustomLevels.h +++ b/desktop_version/src/CustomLevels.h @@ -31,7 +31,6 @@ public: FOREACH_PROP(enemyx2, int) \ FOREACH_PROP(enemyy2, int) \ FOREACH_PROP(enemytype, int) \ - FOREACH_PROP(enemyv, int) \ FOREACH_PROP(directmode, int) class RoomProperty @@ -170,8 +169,6 @@ public: SDL_Color getonewaycol(int rx, int ry); SDL_Color getonewaycol(void); bool onewaycol_override; - - int player_colour; }; bool translate_title(const std::string& title); diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index fe89d98d..a9d8cdc1 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -1048,11 +1048,11 @@ static void draw_entities(void) if (entity->p1 == 0) // Facing right { - graphics.draw_sprite(x - 4, y, 0, graphics.getcol(cl.player_colour)); + graphics.draw_sprite(x - 4, y, 0, graphics.col_crewcyan); } else // Non-zero is facing left { - graphics.draw_sprite(x - 4, y, 3, graphics.getcol(cl.player_colour)); + graphics.draw_sprite(x - 4, y, 3, graphics.col_crewcyan); } graphics.draw_rect(x, y, 16, 24, graphics.getRGB(255, 255, 164)); @@ -1959,8 +1959,6 @@ void editorrenderfixed(void) const RoomProperty* const room = cl.getroomprop(ed.levx, ed.levy); graphics.updatetitlecolours(); - graphics.trinketcolset = false; - game.customcol = cl.getlevelcol(room->tileset, room->tilecol) + 1; ed.entcol = cl.getenemycol(game.customcol); @@ -2107,7 +2105,6 @@ static void input_submitted(void) ed.levx = SDL_clamp(help.Int(coord_x) - 1, 0, cl.mapwidth - 1); ed.levy = SDL_clamp(help.Int(coord_y) - 1, 0, cl.mapheight - 1); - graphics.foregrounddrawn = false; graphics.backgrounddrawn = false; break; } @@ -3098,22 +3095,12 @@ static void handle_draw_input() const int room = ed.levx + ed.levy * cl.maxwidth; const int plat_speed = cl.roomproperties[room].platv; - const int enemy_speed = cl.roomproperties[room].enemyv; - const bool ctrl = key.keymap[SDLK_LCTRL] || key.keymap[SDLK_RCTRL]; - const bool shift = key.keymap[SDLK_LSHIFT] || key.keymap[SDLK_RSHIFT]; if (key.keymap[SDLK_COMMA]) { - if (ctrl) + if (key.keymap[SDLK_LCTRL] || key.keymap[SDLK_RCTRL]) { - if (shift) - { - cl.roomproperties[room].enemyv = enemy_speed - 1; - } - else - { - cl.roomproperties[room].platv = plat_speed - 1; - } + cl.roomproperties[room].platv = plat_speed - 1; } else { @@ -3123,16 +3110,9 @@ static void handle_draw_input() } else if (key.keymap[SDLK_PERIOD]) { - if (ctrl) + if (key.keymap[SDLK_LCTRL] || key.keymap[SDLK_RCTRL]) { - if (shift) - { - cl.roomproperties[room].enemyv = enemy_speed + 1; - } - else - { - cl.roomproperties[room].platv = plat_speed + 1; - } + cl.roomproperties[room].platv = plat_speed + 1; } else { @@ -3153,18 +3133,6 @@ static void handle_draw_input() ed.show_note(buffer); } - if (enemy_speed != cl.roomproperties[room].enemyv) - { - char buffer[3 * SCREEN_WIDTH_CHARS + 1]; - vformat_buf( - buffer, sizeof(buffer), - loc::gettext("Enemy speed is now {speed}"), - "speed:int", - cl.roomproperties[room].enemyv + 4 - ); - ed.show_note(buffer); - } - if (key.keymap[SDLK_SPACE]) { ed.toolbox_open = !ed.toolbox_open; diff --git a/desktop_version/src/Ent.cpp b/desktop_version/src/Ent.cpp index f78da9da..35db8bf6 100644 --- a/desktop_version/src/Ent.cpp +++ b/desktop_version/src/Ent.cpp @@ -11,14 +11,14 @@ entclass::entclass(void) void entclass::clear(void) { invis = false; - type = EntityType_PLAYER; + type = 0; size = 0; tile = 0; rule = 0; state = 0; statedelay = 0; life = 0; - colour = EntityColour_CREW_CYAN; + colour = 0; para = 0; behave = 0; animate = 0; @@ -108,7 +108,7 @@ void entclass::setenemy( int t ) case 0: tile = 60; animate = 2; - colour = EntityColour_ENEMY_RED; + colour = 6; behave = 10; w = 32; h = 32; @@ -119,7 +119,7 @@ void entclass::setenemy( int t ) lerpoldyp += 10; tile = 63; animate = 100; //LIES - colour = EntityColour_ENEMY_RED; + colour = 6; behave = 11; para = 9; //destroyed when outside x1 = -200; @@ -132,7 +132,7 @@ void entclass::setenemy( int t ) case 2: tile = 62; animate = 100; - colour = EntityColour_ENEMY_RED; + colour = 6; behave = -1; w = 32; h = 32; @@ -147,7 +147,7 @@ void entclass::setenemy( int t ) tile = 72; animate = 3; size = 9; - colour = EntityColour_ENEMY_RED; + colour = 6; behave = 12; w = 64; h = 40; @@ -161,7 +161,7 @@ void entclass::setenemy( int t ) lerpoldyp -= 4; tile = 76; animate = 100; // Clouds - colour = EntityColour_ENEMY_RED; + colour = 6; behave = 13; para = -6; //destroyed when outside x2 = 400; @@ -173,7 +173,7 @@ void entclass::setenemy( int t ) case 2: tile = 77; animate = 100; - colour = EntityColour_ENEMY_RED; + colour = 6; behave = -1; w = 32; h = 16; @@ -195,32 +195,32 @@ void entclass::setenemyroom( int rx, int ry ) //Space Station 1 case rn(12, 3): //Security Drone tile = 36; - colour = EntityColour_ENEMY_PINK; + colour = 8; animate = 1; break; case rn(13, 3): //Wavelengths tile = 32; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 1; w = 32; break; case rn(15, 3): //Traffic tile = 28; - colour = EntityColour_ENEMY_RED; + colour = 6; animate = 1; w = 22; h = 32; break; case rn(12, 5): //The Yes Men tile = 40; - colour = EntityColour_ENEMY_YELLOW; + colour = 9; animate = 1; w = 20; h = 20; break; case rn(13, 6): //Hunchbacked Guards tile = 44; - colour = EntityColour_ENEMY_PINK; + colour = 8; animate = 1; w = 16; h = 20; @@ -231,7 +231,7 @@ void entclass::setenemyroom( int rx, int ry ) { //transmittor tile = 104; - colour = EntityColour_INACTIVE_ENTITY; + colour = 4; animate = 7; w = 16; h = 16; @@ -244,7 +244,7 @@ void entclass::setenemyroom( int rx, int ry ) { //radar dish tile =124; - colour = EntityColour_INACTIVE_ENTITY; + colour = 4; animate = 6; w = 32; h = 32; @@ -260,37 +260,37 @@ void entclass::setenemyroom( int rx, int ry ) //The Lab case rn(4, 0): tile = 78; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 1; w = 16; h = 16; break; case rn(2, 0): tile = 88; - colour = EntityColour_ENEMY_CYAN; + colour = 11; animate = 1; w = 16; h = 16; break; //Space Station 2 case rn(14, 11): - colour = EntityColour_ENEMY_ORANGE; + colour = 17; break; //Lies case rn(16, 11): - colour = EntityColour_ENEMY_PINK; + colour = 8; break; //Lies case rn(13, 10): - colour = EntityColour_ENEMY_CYAN; + colour = 11; break; //Factory case rn(13, 9): - colour = EntityColour_ENEMY_YELLOW; + colour = 9; break; //Factory case rn(13, 8): - colour = EntityColour_ENEMY_PINK; + colour = 8; break; //Factory case rn(11, 13): //Truth tile = 64; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 100; w = 44; h = 10; @@ -298,7 +298,7 @@ void entclass::setenemyroom( int rx, int ry ) break; case rn(17, 7): //Brass sent us under the top tile =82; - colour = EntityColour_ENEMY_PINK; + colour = 8; animate = 5; w = 28; h = 32; @@ -306,42 +306,42 @@ void entclass::setenemyroom( int rx, int ry ) break; case rn(10, 7): // (deception) tile = 92; - colour = EntityColour_ENEMY_RED; + colour = 6; animate = 1; w = 16; h = 16; break; case rn(14, 13): // (chose poorly) tile = 56; - colour = EntityColour_ENEMY_RED; + colour = 6; animate = 1; w = 15; h = 24; break; case rn(13, 12): // (backsliders) tile = 164; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 1; w = 16; h = 16; break; case rn(14, 8): // (wheel of fortune room) tile = 116; - colour = EntityColour_ENEMY_BLUE; + colour = 12; animate = 1; w = 32; h = 32; break; case rn(16, 9): // (seeing dollar signs) tile = 68; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 1; w = 16; h = 16; break; case rn(16, 7): // (tomb of mad carew) tile = 106; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 2; w = 24; h = 25; @@ -349,7 +349,7 @@ void entclass::setenemyroom( int rx, int ry ) //Warp Zone case rn(15, 2): // (numbers) tile = 100; - colour = EntityColour_ENEMY_RED; + colour = 6; animate = 1; w = 32; h = 14; @@ -358,7 +358,7 @@ void entclass::setenemyroom( int rx, int ry ) break; case rn(16, 2): // (Manequins) tile = 52; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 5; w = 16; h = 25; @@ -367,28 +367,28 @@ void entclass::setenemyroom( int rx, int ry ) break; case rn(18, 0): // (Obey) tile = 51; - colour = EntityColour_ENEMY_CYAN; + colour = 11; animate = 100; w = 30; h = 14; break; case rn(19, 1): // Ascending and Descending tile = 48; - colour = EntityColour_ENEMY_YELLOW; + colour = 9; animate = 5; w = 16; h = 16; break; case rn(19, 2): // Shockwave Rider tile = 176; - colour = EntityColour_ENEMY_RED; + colour = 6; animate = 1; w = 16; h = 16; break; case rn(18, 3): // Mind the gap tile = 168; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 1; w = 16; h = 16; @@ -397,7 +397,7 @@ void entclass::setenemyroom( int rx, int ry ) if (yp ==96) { tile = 160; - colour = EntityColour_ENEMY_PINK; + colour = 8; animate = 1; w = 16; h = 16; @@ -405,7 +405,7 @@ void entclass::setenemyroom( int rx, int ry ) else { tile = 156; - colour = EntityColour_ENEMY_PINK; + colour = 8; animate = 1; w = 16; h = 16; @@ -413,14 +413,14 @@ void entclass::setenemyroom( int rx, int ry ) break; case rn(16, 0): // I love you tile = 112; - colour = EntityColour_ENEMY_PINK; + colour = 8; animate = 5; w = 16; h = 16; break; case rn(14, 2): // That's why I have to kill you tile = 114; - colour = EntityColour_ENEMY_RED; + colour = 6; animate = 5; w = 16; h = 16; @@ -430,7 +430,7 @@ void entclass::setenemyroom( int rx, int ry ) if (xp ==88) { tile = 54+12; - colour = EntityColour_ENEMY_BLUE; + colour = 12; animate = 100; w = 60; h = 16; @@ -439,7 +439,7 @@ void entclass::setenemyroom( int rx, int ry ) else { tile = 54; - colour = EntityColour_ENEMY_BLUE; + colour = 12; animate = 100; w = 60; h = 16; @@ -449,62 +449,62 @@ void entclass::setenemyroom( int rx, int ry ) //Final level case rn(50-100, 53-100): //The Yes Men tile = 40; - colour = EntityColour_ENEMY_YELLOW; + colour = 9; animate = 1; w = 20; h = 20; break; case rn(48-100, 51-100): //Wavelengths tile = 32; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 1; w = 32; break; case rn(43-100,52-100): // Ascending and Descending tile = 48; - colour = EntityColour_ENEMY_YELLOW; + colour = 9; animate = 5; w = 16; h = 16; break; case rn(46-100,51-100): //kids his age tile = 88; - colour = EntityColour_ENEMY_CYAN; + colour = 11; animate = 1; w = 16; h = 16; break; case rn(43-100,51-100): // Mind the gap tile = 168; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 1; w = 16; h = 16; break; case rn(44-100,51-100): // vertigo? tile = 172; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 100; w = 32; h = 32; break; case rn(44-100,52-100): // (backsliders) tile = 164; - colour = EntityColour_ENEMY_GREEN; + colour = 7; animate = 1; w = 16; h = 16; break; case rn(43-100, 56-100): //Intermission 1 tile = 88; - colour = EntityColour_ENEMY_GRAVITRON; + colour = 21; animate = 1; w = 16; h = 16; break; case rn(45-100, 56-100): //Intermission 1 tile = 88; - colour = EntityColour_ENEMY_GRAVITRON; + colour = 21; animate = 1; w = 16; h = 16; @@ -515,7 +515,7 @@ void entclass::setenemyroom( int rx, int ry ) case rn(11, 8): case rn(12, 8): tile = 0; - colour = EntityColour_TELEPORTER_FLASHING; + colour = 102; animate = 0; w = 464; h = 320; @@ -613,24 +613,17 @@ void entclass::updatecolour(void) switch (size) { case 0: // Sprites - case 3: // Big chunky pixels! - case 4: // Small pickups case 7: // Teleporter case 9: // Really Big Sprite! (2x2) case 10: // 2x1 Sprite case 13: // Special for epilogue: huge hero! realcol = graphics.getcol(colour); break; - case 5: // Horizontal gravity line - case 6: // Vertical gravity line - if (life == 0) - { - realcol = graphics.getcol(colour); - } - else - { - realcol = graphics.getcol(24); - } + case 3: // Big chunky pixels! + realcol = graphics.bigchunkygetcol(colour); + break; + case 4: // Small pickups + realcol = graphics.huetilegetcol(); break; case 11: // The fucking elephant if (game.noflashingmode) @@ -657,8 +650,8 @@ void entclass::updatecolour(void) bool entclass::ishumanoid(void) { - return type == EntityType_PLAYER - || type == EntityType_CREWMATE - || type == EntityType_SUPERCREWMATE - || type == EntityType_COLLECTABLE_CREWMATE; + return type == 0 + || type == 12 + || type == 14 + || type == 55; } diff --git a/desktop_version/src/Ent.h b/desktop_version/src/Ent.h index 3e375a53..f4ddd43c 100644 --- a/desktop_version/src/Ent.h +++ b/desktop_version/src/Ent.h @@ -5,34 +5,6 @@ #define rn( rx, ry) ((rx) + ((ry) * 100)) -enum EntityType -{ - EntityType_INVALID = -1, - EntityType_PLAYER, - EntityType_MOVING, - EntityType_DISAPPEARING_PLATFORM, - EntityType_QUICKSAND, - EntityType_GRAVITY_TOKEN, - EntityType_PARTICLE, - EntityType_COIN, - EntityType_TRINKET, - EntityType_CHECKPOINT, - EntityType_HORIZONTAL_GRAVITY_LINE, - EntityType_VERTICAL_GRAVITY_LINE, - EntityType_WARP_TOKEN, - EntityType_CREWMATE, - EntityType_TERMINAL, - EntityType_SUPERCREWMATE, - EntityType_TROPHY, - EntityType_GRAVITRON_ENEMY = 23, - EntityType_WARP_LINE_LEFT = 51, - EntityType_WARP_LINE_RIGHT = 52, - EntityType_WARP_LINE_TOP = 53, - EntityType_WARP_LINE_BOTTOM = 54, - EntityType_COLLECTABLE_CREWMATE = 55, - EntityType_TELEPORTER = 100 -}; - class entclass { public: @@ -54,13 +26,11 @@ public: public: //Fundamentals bool invis; - EntityType type; - int size, tile, rule; + int type, size, tile, rule; int state, statedelay; int behave, animate; float para; - int life; - int colour; // As out-of-bounds colours are allowed, this should be an int instead of an EnemyColour. + int life, colour; //Position and velocity int oldxp, oldyp; diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index a1d5fc30..210145a8 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -109,13 +109,13 @@ void entityclass::resetallflags(void) int entityclass::swncolour( int t ) { //given colour t, return colour in setcol - if (t == 0) return EntityColour_ENEMY_CYAN; - if (t == 1) return EntityColour_ENEMY_RED; - if (t == 2) return EntityColour_ENEMY_PINK; - if (t == 3) return EntityColour_ENEMY_BLUE; - if (t == 4) return EntityColour_ENEMY_YELLOW; - if (t == 5) return EntityColour_ENEMY_GREEN; - return EntityColour_CREW_CYAN; // Fallback to color 0 + if (t == 0) return 11; + if (t == 1) return 6; + if (t == 2) return 8; + if (t == 3) return 12; + if (t == 4) return 9; + if (t == 5) return 7; + return 0; } void entityclass::swnenemiescol( int t ) @@ -123,7 +123,7 @@ void entityclass::swnenemiescol( int t ) //change the colour of all SWN enemies to the current one for (size_t i = 0; i < entities.size(); i++) { - if (entities[i].type == EntityType_GRAVITRON_ENEMY) + if (entities[i].type == 23) { entities[i].colour = swncolour(t); } @@ -1133,7 +1133,7 @@ bool entityclass::disableentity(int t) entities[t].invis = true; entities[t].size = -1; - entities[t].type = EntityType_INVALID; + entities[t].type = -1; entities[t].rule = -1; entities[t].isplatform = false; @@ -1232,24 +1232,7 @@ static bool gridmatch( int p1, int p2, int p3, int p4, int p11, int p21, int p31 static void entityclonefix(entclass* entity) { - const bool is_lies_emitter = entity->behave == 10; - const bool is_factory_emitter = entity->behave == 12; - - const bool is_emitter = is_lies_emitter || is_factory_emitter; - if (!is_emitter) - { - return; - } - - const bool in_lies_emitter_room = - game.roomx >= 113 && game.roomx <= 117 && game.roomy == 111; - const bool in_factory_emitter_room = - game.roomx == 113 && game.roomy >= 108 && game.roomy <= 110; - - const bool valid = (is_lies_emitter && in_lies_emitter_room) - || (is_factory_emitter && in_factory_emitter_room); - - if (!valid) + if (entity->behave == 10 || entity->behave == 12) { /* Fix memory leak */ entity->behave = -1; @@ -1269,7 +1252,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int { if (entities[i].invis && entities[i].size == -1 - && entities[i].type == EntityType_INVALID + && entities[i].type == -1 && entities[i].rule == -1 && !entities[i].isplatform) { @@ -1292,7 +1275,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int //Size 1 is a tile //Beyond that are special cases (to do) //Size 2 is a moving platform of width 4 (32) - //Size 3 is apparently a "big chunky pixel" + //Size 3 is apparently a "bug chunky pixel" //Size 4 is a coin/small pickup //Size 5 is a horizontal line, 6 is vertical @@ -1318,19 +1301,18 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int entclass& entity = *entptr; entity.xp = xp; entity.yp = yp; - entity.type = EntityType_INVALID; + entity.type = t; switch(t) { case 0: //Player entity.rule = 0; //Playable character entity.tile = 0; - entity.colour = EntityColour_CREW_CYAN; + entity.colour = 0; entity.cx = 6; entity.cy = 2; entity.w = 12; entity.h = 21; entity.dir = 1; - entity.type = EntityType_PLAYER; /* Fix wrong y-position if spawning in on conveyor */ entity.newxp = xp; @@ -1357,9 +1339,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int entity.harmful = true; entity.tile = 24; entity.animate = 0; - entity.colour = EntityColour_ENEMY_PINK; - - entity.type = EntityType_MOVING; + entity.colour = 8; if (game.roomy == 111 && (game.roomx >= 113 && game.roomx <= 117)) { @@ -1375,7 +1355,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int { //MAVVERRRICK entity.tile = 96; - entity.colour = EntityColour_ENEMY_RED; + entity.colour = 6; entity.size = 9; entity.w = 64; entity.h = 44; @@ -1389,7 +1369,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 2: //A moving platform entity.rule = 2; - entity.type = EntityType_MOVING; + entity.type = 1; entity.size = 2; entity.tile = 1; @@ -1457,7 +1437,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 3: //Disappearing platforms entity.rule = 3; - entity.type = EntityType_DISAPPEARING_PLATFORM; + entity.type = 2; entity.size = 2; entity.tile = 2; //appearance again depends on location @@ -1487,7 +1467,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 4: //Breakable blocks entity.rule = 6; - entity.type = EntityType_QUICKSAND; + entity.type = 3; entity.size = 1; entity.tile = 10; entity.cy = -1; @@ -1502,7 +1482,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 5: //Gravity Tokens entity.rule = 3; - entity.type = EntityType_GRAVITY_TOKEN; + entity.type = 4; entity.size = 0; entity.tile = 11; entity.w = 16; @@ -1514,8 +1494,8 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 6: //Decorative particles entity.rule = 2; - entity.type = EntityType_PARTICLE; //Particles - entity.colour = EntityColour_PARTICLE_RED; + entity.type = 5; //Particles + entity.colour = 1; entity.size = 3; entity.vx = meta1; entity.vy = meta2; @@ -1524,8 +1504,8 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 7: //Decorative particles entity.rule = 2; - entity.type = EntityType_PARTICLE; //Particles - entity.colour = EntityColour_CREW_CYAN; + entity.type = 5; //Particles + entity.colour = 2; entity.size = 3; entity.vx = meta1; entity.vy = meta2; @@ -1534,9 +1514,8 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 8: //Small collectibles entity.rule = 3; - entity.type = EntityType_COIN; + entity.type = 6; entity.size = 4; - entity.colour = EntityColour_COIN; entity.tile = 48; entity.w = 8; entity.h = 8; @@ -1549,12 +1528,12 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 9: //Something Shiny entity.rule = 3; - entity.type = EntityType_TRINKET; + entity.type = 7; entity.size = 0; entity.tile = 22; entity.w = 16; entity.h = 16; - entity.colour = EntityColour_TRINKET; + entity.colour = 3; entity.onentity = 1; entity.animate = 100; @@ -1564,19 +1543,19 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 10: //Savepoint entity.rule = 3; - entity.type = EntityType_CHECKPOINT; + entity.type = 8; entity.size = 0; entity.tile = 20 + meta1; entity.w = 16; entity.h = 16; - entity.colour = EntityColour_INACTIVE_ENTITY; + entity.colour = 4; entity.onentity = 1; entity.animate = 100; entity.para = meta2; if (game.savepoint == meta2) { - entity.colour = EntityColour_ACTIVE_ENTITY; + entity.colour = 5; entity.onentity = 0; } @@ -1587,33 +1566,31 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 11: //Horizontal Gravity Line entity.rule = 4; - entity.type = EntityType_HORIZONTAL_GRAVITY_LINE; + entity.type = 9; entity.size = 5; entity.life = 0; - entity.colour = EntityColour_GRAVITY_LINE_ACTIVE; entity.w = meta1; entity.h = 1; entity.onentity = 1; break; case 12: //Vertical Gravity Line entity.rule = 5; - entity.type = EntityType_VERTICAL_GRAVITY_LINE; + entity.type = 10; entity.size = 6; entity.life = 0; - entity.colour = EntityColour_GRAVITY_LINE_ACTIVE; entity.w = 1; entity.h = meta1; - //entity.colour = EntityColour_CREW_CYAN; + //entity.colour = 0; entity.onentity = 1; break; case 13: //Warp token entity.rule = 3; - entity.type = EntityType_WARP_TOKEN; + entity.type = 11; entity.size = 0; entity.tile = 18; entity.w = 16; entity.h = 16; - entity.colour = EntityColour_WARP_TOKEN; + entity.colour = 10; entity.onentity = 1; entity.animate = 2; //Added in port, hope it doesn't break anything @@ -1622,21 +1599,21 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 14: // Teleporter entity.rule = 3; - entity.type = EntityType_TELEPORTER; + entity.type = 100; entity.size = 7; entity.tile = 1; //inactive entity.w = 96; entity.h = 96; - entity.colour = EntityColour_TELEPORTER_INACTIVE; + entity.colour = 100; entity.onentity = 1; entity.animate = 100; entity.para = meta2; break; case 15: // Crew Member (warp zone) entity.rule = 6; - entity.type = EntityType_CREWMATE; //A special case! + entity.type = 12; //A special case! entity.tile = 144; - entity.colour = EntityColour_CREW_GREEN; //144 for sad :( + entity.colour = 13; //144 for sad :( entity.cx = 6; entity.cy = 2; entity.w = 12; @@ -1649,9 +1626,9 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 16: // Crew Member, upside down (space station) entity.rule = 7; - entity.type = EntityType_CREWMATE; //A special case! + entity.type = 12; //A special case! entity.tile = 144+6; - entity.colour = EntityColour_CREW_YELLOW; //144 for sad (upside down+12):( + entity.colour = 14; //144 for sad (upside down+12):( entity.cx = 6; entity.cy = 2; entity.w = 12; @@ -1664,9 +1641,9 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 17: // Crew Member (Lab) entity.rule = 6; - entity.type = EntityType_CREWMATE; //A special case! + entity.type = 12; //A special case! entity.tile = 144; - entity.colour = EntityColour_CREW_BLUE; //144 for sad :( + entity.colour = 16; //144 for sad :( entity.cx = 6; entity.cy = 2; entity.w = 12; @@ -1680,7 +1657,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int case 18: // Crew Member (Ship) //This is the scriping crewmember entity.rule = 6; - entity.type = EntityType_CREWMATE; //A special case! + entity.type = 12; //A special case! entity.colour = meta1; if (meta2 == 0) { @@ -1708,9 +1685,9 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 19: // Crew Member (Ship) More tests! entity.rule = 6; - entity.type = EntityType_CREWMATE; //A special case! + entity.type = 12; //A special case! entity.tile = 0; - entity.colour = EntityColour_ENEMY_RED; //54 for sad :( + entity.colour = 6; //54 for sad :( entity.cx = 6; entity.cy = 2; entity.w = 12; @@ -1723,36 +1700,36 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 20: //Terminal entity.rule = 3; - entity.type = EntityType_TERMINAL; + entity.type = 13; entity.size = 0; entity.tile = 16 + meta1; entity.w = 16; entity.h = 16; - entity.colour = EntityColour_INACTIVE_ENTITY; + entity.colour = 4; entity.onentity = 1; entity.animate = 100; entity.para = meta2; break; case 21: //as above, except doesn't highlight entity.rule = 3; - entity.type = EntityType_TERMINAL; + entity.type = 13; entity.size = 0; entity.tile = 16 + meta1; entity.w = 16; entity.h = 16; - entity.colour = EntityColour_INACTIVE_ENTITY; + entity.colour = 4; entity.onentity = 0; entity.animate = 100; entity.para = meta2; break; case 22: //Fake trinkets, only appear if you've collected them entity.rule = 3; - entity.type = EntityType_TRINKET; + entity.type = 7; entity.size = 0; entity.tile = 22; entity.w = 16; entity.h = 16; - entity.colour = EntityColour_TRINKET; + entity.colour = 3; entity.onentity = 0; entity.animate = 100; @@ -1763,7 +1740,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int case 23: //SWN Enemies //Given a different behavior, these enemies are especially for SWN mode and disappear outside the screen. entity.rule = 1; - entity.type = EntityType_GRAVITRON_ENEMY; + entity.type = 23; entity.behave = meta1; entity.para = meta2; entity.w = 16; @@ -1780,7 +1757,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int //initilise tiles here based on behavior entity.size = 12; //don't wrap around - entity.colour = EntityColour_ENEMY_GRAVITRON; + entity.colour = 21; entity.tile = 78; //default case entity.animate = 1; if (game.swngame == SWN_SUPERGRAVITRON) @@ -1792,7 +1769,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int case 24: // Super Crew Member //This special crewmember is way more advanced than the usual kind, and can interact with game objects entity.rule = 6; - entity.type = EntityType_SUPERCREWMATE; //A special case! + entity.type = 14; //A special case! entity.colour = meta1; if (meta1 == 16) { @@ -1834,11 +1811,11 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 25: //Trophies entity.rule = 3; - entity.type = EntityType_TROPHY; + entity.type = 15; entity.size = 0; entity.w = 16; entity.h = 16; - entity.colour = EntityColour_INACTIVE_ENTITY; + entity.colour = 4; entity.onentity = 1; entity.animate = 100; entity.para = meta2; @@ -1852,42 +1829,42 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if (game.bestrank[TimeTrial_SPACESTATION1] >= 3) { entity.tile = 184 + meta1; - entity.colour = EntityColour_TROPHY_SPACE_STATION_1; + entity.colour = 31; } break; case 2: if (game.bestrank[TimeTrial_LABORATORY] >= 3) { entity.tile = 186 + meta1; - entity.colour = EntityColour_TROPHY_LABORATORY; + entity.colour = 35; } break; case 3: if (game.bestrank[TimeTrial_TOWER] >= 3) { entity.tile = 184 + meta1; - entity.colour = EntityColour_TROPHY_TOWER; + entity.colour = 33; } break; case 4: if (game.bestrank[TimeTrial_SPACESTATION2] >= 3) { entity.tile = 184 + meta1; - entity.colour = EntityColour_TROPHY_SPACE_STATION_2; + entity.colour = 32; } break; case 5: if (game.bestrank[TimeTrial_WARPZONE] >= 3) { entity.tile = 184 + meta1; - entity.colour = EntityColour_TROPHY_WARP_ZONE; + entity.colour = 34; } break; case 6: if (game.bestrank[TimeTrial_FINALLEVEL] >= 3) { entity.tile = 184 + meta1; - entity.colour = EntityColour_TROPHY_FINAL_LEVEL; + entity.colour = 30; } break; @@ -1895,7 +1872,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if (game.unlock[UnlockTrophy_GAME_COMPLETE]) { entity.tile = 188 + meta1; - entity.colour = EntityColour_TROPHY_GAME_COMPLETE; + entity.colour = 37; entity.h += 3; entity.yp -= 3; } @@ -1904,7 +1881,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if (game.unlock[UnlockTrophy_FLIPMODE_COMPLETE]) { entity.tile = 188 + meta1; - entity.colour = EntityColour_TROPHY_GAME_COMPLETE; + entity.colour = 37; entity.h += 3; } break; @@ -1915,7 +1892,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if (game.bestgamedeaths <= 50) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_FLASHY; + entity.colour = 40; } } break; @@ -1925,7 +1902,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if (game.bestgamedeaths <= 100) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_GOLD; + entity.colour = 36; } } break; @@ -1935,7 +1912,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if (game.bestgamedeaths <= 250) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_SILVER; + entity.colour = 38; } } break; @@ -1945,7 +1922,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if (game.bestgamedeaths <= 500) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_BRONZE; + entity.colour = 39; } } break; @@ -1954,42 +1931,42 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if(game.swnbestrank>=1) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_BRONZE; + entity.colour = 39; } break; case 14: if(game.swnbestrank>=2) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_BRONZE; + entity.colour = 39; } break; case 15: if(game.swnbestrank>=3) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_BRONZE; + entity.colour = 39; } break; case 16: if(game.swnbestrank>=4) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_SILVER; + entity.colour = 38; } break; case 17: if(game.swnbestrank>=5) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_GOLD; + entity.colour = 36; } break; case 18: if(game.swnbestrank>=6) { entity.tile = 182 + meta1; - entity.colour = EntityColour_TROPHY_FLASHY; + entity.colour = 40; } break; @@ -1997,7 +1974,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int if (game.unlock[UnlockTrophy_NODEATHMODE_COMPLETE]) { entity.tile = 3; - entity.colour = EntityColour_TELEPORTER_FLASHING; + entity.colour = 102; entity.size = 13; entity.xp -= 64; entity.yp -= 128; @@ -2009,12 +1986,12 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 26: //Epilogue super warp token entity.rule = 3; - entity.type = EntityType_WARP_TOKEN; + entity.type = 11; entity.size = 0; entity.tile = 18; entity.w = 16; entity.h = 16; - entity.colour = EntityColour_TRINKET; + entity.colour = 3; entity.onentity = 0; entity.animate = 100; entity.para = meta2; @@ -2026,23 +2003,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int case 52: /* Vertical */ case 53: /* Horizontal */ case 54: /* Horizontal */ - if (t == 51) - { - entity.type = EntityType_WARP_LINE_LEFT; - } - else if (t == 52) - { - entity.type = EntityType_WARP_LINE_RIGHT; - } - else if (t == 53) - { - entity.type = EntityType_WARP_LINE_TOP; - } - else - { - entity.type = EntityType_WARP_LINE_BOTTOM; - } - + entity.type = t; entity.onentity = 1; entity.invis = true; entity.life = 0; @@ -2074,7 +2035,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int //1 - position in array //2 - colour entity.rule = 3; - entity.type = EntityType_COLLECTABLE_CREWMATE; + entity.type = 55; if(INBOUNDS_ARR(meta2, customcrewmoods) && customcrewmoods[meta2]==1){ entity.tile = 144; @@ -2100,7 +2061,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int break; case 56: //Custom enemy entity.rule = 1; - entity.type = EntityType_MOVING; + entity.type = 1; entity.behave = meta1; entity.para = meta2; entity.w = 16; @@ -2137,48 +2098,45 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int //RED case 3: case 7: case 12: case 23: case 28: case 34: case 42: case 48: case 58: - entity.colour = EntityColour_ENEMY_RED; break; + entity.colour = 6; break; //GREEN case 5: case 9: case 22: case 25: case 29: case 31: case 38: case 46: case 52: case 53: - entity.colour = EntityColour_ENEMY_GREEN; break; + entity.colour = 7; break; //BLUE case 1: case 6: case 14: case 27: case 33: case 44: case 50: case 57: - entity.colour = EntityColour_ENEMY_BLUE; break; + entity.colour = 12; break; //YELLOW case 4: case 17: case 24: case 30: case 37: case 45: case 51: case 55: - entity.colour = EntityColour_ENEMY_YELLOW; break; + entity.colour = 9; break; //PURPLE case 2: case 11: case 15: case 19: case 32: case 36: case 49: - entity.colour = EntityColour_CREW_PURPLE; break; + entity.colour = 20; break; //CYAN case 8: case 10: case 13: case 18: case 26: case 35: case 41: case 47: case 54: - entity.colour = EntityColour_ENEMY_CYAN; break; + entity.colour = 11; break; //PINK case 16: case 20: case 39: case 43: case 56: - entity.colour = EntityColour_ENEMY_PINK; break; + entity.colour = 8; break; //ORANGE case 21: case 40: - entity.colour = EntityColour_ENEMY_ORANGE; break; + entity.colour = 17; break; default: - entity.colour = EntityColour_ENEMY_RED; + entity.colour = 6; break; } } if(custom_gray){ - entity.colour = EntityColour_ENEMY_GRAY; + entity.colour = 18; } entityclonefix(&entity); break; - case 100: // Invalid enemy, but gets treated as a teleporter - entity.type = EntityType_TELEPORTER; - break; } entity.lerpoldxp = entity.xp; @@ -2194,7 +2152,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int * This is a bit kludge-y but it's better than copy-pasting * and is okay to do because entity 12 does not change state on its own */ - if (entity.type == EntityType_CREWMATE) + if (entity.type == 12) { size_t indice; if (reuse) @@ -2247,9 +2205,9 @@ bool entityclass::updateentities( int i ) { switch(entities[i].type) { - case EntityType_PLAYER: //Player + case 0: //Player break; - case EntityType_MOVING: //Movement behaviors + case 1: //Movement behaviors //Enemies can have a number of different behaviors: switch(entities[i].behave) { @@ -2479,7 +2437,7 @@ bool entityclass::updateentities( int i ) { for (size_t j = 0; j < entities.size(); j++) { - if (entities[j].type == EntityType_DISAPPEARING_PLATFORM && entities[j].state== 3 && entities[j].xp == (entities[i].xp-32) ) + if (entities[j].type == 2 && entities[j].state== 3 && entities[j].xp == (entities[i].xp-32) ) { entities[i].state = 3; bool entitygone = updateentities(i); @@ -2509,7 +2467,7 @@ bool entityclass::updateentities( int i ) { for (size_t j = 0; j < entities.size(); j++) { - if (entities[j].type == EntityType_DISAPPEARING_PLATFORM && entities[j].state==3 && entities[j].xp==entities[i].xp+32) + if (entities[j].type == 2 && entities[j].state==3 && entities[j].xp==entities[i].xp+32) { entities[i].state = 3; bool entitygone = updateentities(i); @@ -2607,7 +2565,7 @@ bool entityclass::updateentities( int i ) break; } break; - case EntityType_DISAPPEARING_PLATFORM: //Disappearing platforms + case 2: //Disappearing platforms //wait for collision if (entities[i].state == 1) { @@ -2654,7 +2612,7 @@ bool entityclass::updateentities( int i ) } } break; - case EntityType_QUICKSAND: //Breakable blocks + case 3: //Breakable blocks //Only counts if vy of player entity is non zero if (entities[i].state == 1) { @@ -2674,7 +2632,7 @@ bool entityclass::updateentities( int i ) } } break; - case EntityType_GRAVITY_TOKEN: //Gravity token + case 4: //Gravity token //wait for collision if (entities[i].state == 1) { @@ -2684,7 +2642,7 @@ bool entityclass::updateentities( int i ) } break; - case EntityType_PARTICLE: //Particle sprays + case 5: //Particle sprays if (entities[i].state == 0) { entities[i].life--; @@ -2694,7 +2652,7 @@ bool entityclass::updateentities( int i ) } } break; - case EntityType_COIN: //Small pickup + case 6: //Small pickup //wait for collision if (entities[i].state == 1) { @@ -2707,7 +2665,7 @@ bool entityclass::updateentities( int i ) return disableentity(i); } break; - case EntityType_TRINKET: //Found a trinket + case 7: //Found a trinket //wait for collision if (entities[i].state == 1) { @@ -2735,20 +2693,20 @@ bool entityclass::updateentities( int i ) return disableentity(i); } break; - case EntityType_CHECKPOINT: //Savepoints + case 8: //Savepoints //wait for collision if (entities[i].state == 1) { //First, deactivate all other savepoints for (size_t j = 0; j < entities.size(); j++) { - if (entities[j].type == EntityType_CHECKPOINT) + if (entities[j].type == 8) { - entities[j].colour = EntityColour_INACTIVE_ENTITY; + entities[j].colour = 4; entities[j].onentity = 1; } } - entities[i].colour = EntityColour_ACTIVE_ENTITY; + entities[i].colour = 5; entities[i].onentity = 0; game.savepoint = entities[i].para; music.playef(Sound_CHECKPOINT); @@ -2774,11 +2732,9 @@ bool entityclass::updateentities( int i ) game.savedir = entities[player].dir; } entities[i].state = 0; - - game.checkpoint_save(); } break; - case EntityType_HORIZONTAL_GRAVITY_LINE: //Gravity Lines + case 9: //Gravity Lines if (entities[i].state == 1) { entities[i].life--; @@ -2791,7 +2747,7 @@ bool entityclass::updateentities( int i ) } } break; - case EntityType_VERTICAL_GRAVITY_LINE: //Vertical gravity Lines + case 10: //Vertical gravity Lines if (entities[i].state == 1) { entities[i].onentity = 3; @@ -2833,7 +2789,7 @@ bool entityclass::updateentities( int i ) entities[i].state = 2; } break; - case EntityType_WARP_TOKEN: //Warp point + case 11: //Warp point //wait for collision if (entities[i].state == 1) { @@ -2851,7 +2807,7 @@ bool entityclass::updateentities( int i ) if (int(entities[i].xp) == 21*8) game.teleportxpos = 4; } break; - case EntityType_CREWMATE: //Crew member + case 12: //Crew member //Somewhat complex AI: exactly what they do depends on room, location, state etc //At state 0, do nothing at all. if (entities[i].state == 1) @@ -2936,7 +2892,7 @@ bool entityclass::updateentities( int i ) else if (entities[i].state == 11) { //11-15 means to follow a specific character, in crew order (cyan, purple, yellow, red, green, blue) - int j=getcrewman(EntityColour_CREW_PURPLE); + int j=getcrewman(PURPLE); if (INBOUNDS_VEC(j, entities)) { if (entities[j].xp > entities[i].xp + 5) @@ -2961,7 +2917,7 @@ bool entityclass::updateentities( int i ) else if (entities[i].state == 12) { //11-15 means to follow a specific character, in crew order (cyan, purple, yellow, red, green, blue) - int j=getcrewman(EntityColour_CREW_YELLOW); + int j=getcrewman(YELLOW); if (INBOUNDS_VEC(j, entities)) { if (entities[j].xp > entities[i].xp + 5) @@ -2986,7 +2942,7 @@ bool entityclass::updateentities( int i ) else if (entities[i].state == 13) { //11-15 means to follow a specific character, in crew order (cyan, purple, yellow, red, green, blue) - int j=getcrewman(EntityColour_CREW_RED); + int j=getcrewman(RED); if (INBOUNDS_VEC(j, entities)) { if (entities[j].xp > entities[i].xp + 5) @@ -3011,7 +2967,7 @@ bool entityclass::updateentities( int i ) else if (entities[i].state == 14) { //11-15 means to follow a specific character, in crew order (cyan, purple, yellow, red, green, blue) - int j=getcrewman(EntityColour_CREW_GREEN); + int j=getcrewman(GREEN); if (INBOUNDS_VEC(j, entities)) { if (entities[j].xp > entities[i].xp + 5) @@ -3036,7 +2992,7 @@ bool entityclass::updateentities( int i ) else if (entities[i].state == 15) { //11-15 means to follow a specific character, in crew order (cyan, purple, yellow, red, green, blue) - int j=getcrewman(EntityColour_CREW_BLUE); + int j=getcrewman(BLUE); if (INBOUNDS_VEC(j, entities)) { if (entities[j].xp > entities[i].xp + 5) @@ -3186,18 +3142,18 @@ bool entityclass::updateentities( int i ) } } break; - case EntityType_TERMINAL: //Terminals (very similar to savepoints) + case 13: //Terminals (very similar to savepoints) //wait for collision if (entities[i].state == 1) { - entities[i].colour = EntityColour_ACTIVE_ENTITY; + entities[i].colour = 5; entities[i].onentity = 0; music.playef(Sound_TERMINALTOUCH); entities[i].state = 0; } break; - case EntityType_SUPERCREWMATE: //Super Crew member + case 14: //Super Crew member //Actually needs less complex AI than the scripting crewmember if (entities[i].state == 0) { @@ -3253,7 +3209,7 @@ bool entityclass::updateentities( int i ) } } break; - case EntityType_TROPHY: //Trophy + case 15: //Trophy //wait for collision if (entities[i].state == 1) { @@ -3264,7 +3220,7 @@ bool entityclass::updateentities( int i ) entities[i].state = 0; } break; - case EntityType_GRAVITRON_ENEMY: + case 23: //swn game! switch(entities[i].behave) { @@ -3291,7 +3247,7 @@ bool entityclass::updateentities( int i ) } break; - case EntityType_WARP_LINE_LEFT: //Vertical warp line + case 51: //Vertical warp line if (entities[i].state == 2){ int j=getplayer(); if(INBOUNDS_VEC(j, entities) && entities[j].xp<=307){ @@ -3306,7 +3262,7 @@ bool entityclass::updateentities( int i ) customwarpmodevon=true; } break; - case EntityType_WARP_LINE_RIGHT: //Vertical warp line + case 52: //Vertical warp line if (entities[i].state == 2){ int j=getplayer(); if(INBOUNDS_VEC(j, entities) && entities[j].xp<=307){ @@ -3321,7 +3277,7 @@ bool entityclass::updateentities( int i ) customwarpmodevon=true; } break; - case EntityType_WARP_LINE_TOP: //Warp lines Horizonal + case 53: //Warp lines Horizonal if (entities[i].state == 2){ customwarpmodehon=false; entities[i].state = 0; @@ -3333,7 +3289,7 @@ bool entityclass::updateentities( int i ) customwarpmodehon=true; } break; - case EntityType_WARP_LINE_BOTTOM: //Warp lines Horizonal + case 54: //Warp lines Horizonal if (entities[i].state == 2){ customwarpmodehon=false; entities[i].state = 0; @@ -3345,7 +3301,7 @@ bool entityclass::updateentities( int i ) customwarpmodehon=true; } break; - case EntityType_COLLECTABLE_CREWMATE: //Collectable crewmate + case 55: //Collectable crewmate //wait for collision if (entities[i].state == 0) { @@ -3382,7 +3338,7 @@ bool entityclass::updateentities( int i ) return disableentity(i); } break; - case EntityType_TELEPORTER: //The teleporter + case 100: //The teleporter if (entities[i].state == 1) { //if inactive, activate! @@ -3390,7 +3346,7 @@ bool entityclass::updateentities( int i ) { music.playef(Sound_GAMESAVED); entities[i].tile = 2; - entities[i].colour = EntityColour_TELEPORTER_ACTIVE; + entities[i].colour = 101; if(!game.intimetrial && !game.nodeathmode) { game.setstate(2000); @@ -3408,9 +3364,9 @@ bool entityclass::updateentities( int i ) //First, deactivate all other savepoints for (size_t j = 0; j < entities.size(); j++) { - if (entities[j].type == EntityType_CHECKPOINT) + if (entities[j].type == 8) { - entities[j].colour = EntityColour_INACTIVE_ENTITY; + entities[j].colour = 4; entities[j].onentity = 1; } } @@ -3436,7 +3392,7 @@ bool entityclass::updateentities( int i ) //Initilise the teleporter without changing the game state or playing sound entities[i].onentity = 0; entities[i].tile = 6; - entities[i].colour = EntityColour_TELEPORTER_FLASHING; + entities[i].colour = 102; game.activetele = true; game.teleblock.x = entities[i].xp - 32; @@ -3447,8 +3403,6 @@ bool entityclass::updateentities( int i ) entities[i].state = 0; } break; - case EntityType_INVALID: // Invalid entity, do nothing! - break; } } else @@ -3475,7 +3429,7 @@ void entityclass::animateentities( int _i ) { switch(entities[_i].type) { - case EntityType_PLAYER: + case 0: entities[_i].framedelay--; if(entities[_i].dir==1) { @@ -3524,8 +3478,8 @@ void entityclass::animateentities( int _i ) if (game.gravitycontrol == 1) entities[_i].drawframe += 2; } break; - case EntityType_MOVING: - case EntityType_GRAVITRON_ENEMY: + case 1: + case 23: //Variable animation switch(entities[_i].animate) { @@ -3713,10 +3667,10 @@ void entityclass::animateentities( int _i ) break; } break; - case EntityType_DISAPPEARING_PLATFORM: //Disappearing platforms + case 2: //Disappearing platforms entities[_i].drawframe = entities[_i].tile + entities[_i].walkingframe; break; - case EntityType_WARP_TOKEN: + case 11: entities[_i].drawframe = entities[_i].tile; if(entities[_i].animate==2) { @@ -3736,9 +3690,9 @@ void entityclass::animateentities( int _i ) entities[_i].drawframe += entities[_i].walkingframe; } break; - case EntityType_CREWMATE: - case EntityType_COLLECTABLE_CREWMATE: - case EntityType_SUPERCREWMATE: //Crew member! Very similar to hero + case 12: + case 55: + case 14: //Crew member! Very similar to hero entities[_i].framedelay--; if(entities[_i].dir==1) { @@ -3781,7 +3735,7 @@ void entityclass::animateentities( int _i ) //if (game.gravitycontrol == 1) entities[_i].drawframe += 2; } break; - case EntityType_TELEPORTER: //the teleporter! + case 100: //the teleporter! if (entities[_i].tile == 1 || game.noflashingmode) { //it's inactive @@ -3907,7 +3861,7 @@ void entityclass::animatehumanoidcollision(const int i) { ++entity->collisiondrawframe; - if (entity->type == EntityType_PLAYER && game.gravitycontrol == 1) + if (entity->type == 0 && game.gravitycontrol == 1) { entity->collisiondrawframe += 6; } @@ -3923,8 +3877,8 @@ void entityclass::animatehumanoidcollision(const int i) entity->collisiondrawframe = 12; } - if ((entity->type == EntityType_PLAYER && game.gravitycontrol == 1) - || (entity->type != EntityType_PLAYER && entity->rule == 7)) + if ((entity->type == 0 && game.gravitycontrol == 1) + || (entity->type != 0 && entity->rule == 7)) { entity->collisiondrawframe += 2; } @@ -3954,7 +3908,7 @@ int entityclass::getplayer(void) //Returns the index of the first player entity for (size_t i = 0; i < entities.size(); i++) { - if (entities[i].type == EntityType_PLAYER) + if(entities[i].type==0) { return i; } @@ -3968,7 +3922,7 @@ int entityclass::getscm(void) //Returns the supercrewmate for (size_t i = 0; i < entities.size(); i++) { - if (entities[i].type == EntityType_SUPERCREWMATE) + if(entities[i].type==14) { return i; } @@ -3994,39 +3948,40 @@ int entityclass::getlineat( int t ) return 0; } -int entityclass::getcrewman(int t) +int entityclass::getcrewman( int t, int fallback /*= 0*/ ) { - // Returns the index of the crewman with colour index given by t. - // Note: this takes an int, not an EntityColour, as invalid colours are allowed in scripting + //Returns the index of the crewman with colour index given by t for (size_t i = 0; i < entities.size(); i++) { - if ((entities[i].type == EntityType_CREWMATE || entities[i].type == EntityType_SUPERCREWMATE) - && (entities[i].rule == 6 || entities[i].rule == 7)) + if ((entities[i].type == 12 || entities[i].type == 14) + && (entities[i].rule == 6 || entities[i].rule == 7)) { - if (entities[i].colour == t) + if(entities[i].colour==t) { return i; } } } - // Return entity 0 as a fallback - // Unfortunately some levels rely on this, where targeting a non-existent crewman returns the first entity... - // Which, most of the time, is the player. - - return 0; + return fallback; } -int entityclass::getcustomcrewman(int t) +int entityclass::getcustomcrewman( int t ) { - // like getcrewman, this returns the index of the CUSTOM crewman with colour index given by t + //Returns the index of the crewman with colour index given by t + if (t == 0) t = 0; + if (t == 1) t = 20; + if (t == 2) t = 14; + if (t == 3) t = 15; + if (t == 4) t = 13; + if (t == 5) t = 16; for (size_t i = 0; i < entities.size(); i++) { - if (entities[i].type == EntityType_COLLECTABLE_CREWMATE) + if (entities[i].type == 55) { - if (entities[i].colour == t) + if(entities[i].colour==t) { return i; } @@ -4040,7 +3995,7 @@ int entityclass::getteleporter(void) { for (size_t i = 0; i < entities.size(); i++) { - if (entities[i].type == EntityType_TELEPORTER) + if(entities[i].type==100) { return i; } @@ -4079,7 +4034,7 @@ bool entityclass::checkdamage(bool scm /*= false*/) //Returns true if player (or supercrewmate) collides with a damagepoint for(size_t i=0; i < entities.size(); i++) { - if((scm && entities[i].type == EntityType_SUPERCREWMATE) || (!scm && entities[i].rule == 0)) + if((scm && entities[i].type == 14) || (!scm && entities[i].rule == 0)) { SDL_Rect temprect; temprect.x = entities[i].xp + entities[i].cx; @@ -4494,7 +4449,7 @@ bool entityclass::testwallsx( int t, int tx, int ty, const bool skipdirblocks ) temprect.w = entities[t].w; temprect.h = entities[t].h; - bool skipblocks = entities[t].rule < 2 || entities[t].type == EntityType_SUPERCREWMATE; + bool skipblocks = entities[t].rule < 2 || entities[t].type == 14; float dx = 0; float dy = 0; if (entities[t].rule == 0) dx = entities[t].vx; @@ -4540,7 +4495,7 @@ bool entityclass::testwallsy( int t, int tx, int ty ) temprect.w = entities[t].w; temprect.h = entities[t].h; - bool skipblocks = entities[t].rule < 2 || entities[t].type == EntityType_SUPERCREWMATE; + bool skipblocks = entities[t].rule < 2 || entities[t].type == 14; float dx = 0; float dy = 0; @@ -4722,13 +4677,13 @@ void entityclass::customwarplinecheck(int i) { for (int j = 0; j < (int) entities.size(); j++) { if (i != j) { if (entities[i].rule == 0 && entities[j].rule == 5 //Player vs vertical line! - && (entities[j].type == EntityType_WARP_LINE_LEFT || entities[j].type == EntityType_WARP_LINE_RIGHT) + && (entities[j].type == 51 || entities[j].type == 52) && entitywarpvlinecollide(i, j)) { customwarpmodevon = true; } if (entities[i].rule == 0 && entities[j].rule == 7 //Player vs horizontal WARP line - && (entities[j].type == EntityType_WARP_LINE_TOP || entities[j].type == EntityType_WARP_LINE_BOTTOM) + && (entities[j].type == 53 || entities[j].type == 54) && entitywarphlinecollide(i, j)) { customwarpmodehon = true; } @@ -4741,7 +4696,7 @@ void entityclass::entitycollisioncheck(void) for (size_t i = 0; i < entities.size(); i++) { bool player = entities[i].rule == 0; - bool scm = game.supercrewmate && entities[i].type == EntityType_SUPERCREWMATE; + bool scm = game.supercrewmate && entities[i].type == 14; if (!player && !scm) { continue; diff --git a/desktop_version/src/Entity.h b/desktop_version/src/Entity.h index 25197a5e..796918b3 100644 --- a/desktop_version/src/Entity.h +++ b/desktop_version/src/Entity.h @@ -5,10 +5,10 @@ #include #include -#include "BlockV.h" -#include "Ent.h" -#include "Game.h" #include "Maths.h" +#include "Ent.h" +#include "BlockV.h" +#include "Game.h" enum { @@ -20,6 +20,18 @@ enum ACTIVITY = 5 }; +enum +{ + CYAN = 0, + PURPLE = 20, + YELLOW = 14, + RED = 15, + GREEN = 13, + BLUE = 16, + GRAY = 19, + TELEPORTER = 102 +}; + class entityclass { public: @@ -44,7 +56,7 @@ public: createblock(DAMAGE, 312, -8, 16, 260); } - int swncolour(int t); + int swncolour(int t ); void swnenemiescol(int t); @@ -94,7 +106,7 @@ public: int getlineat(int t); - int getcrewman(int t); + int getcrewman(int t, int fallback = 0); int getcustomcrewman(int t); int getteleporter(void); diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index beb41917..5643182d 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -342,7 +342,6 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath, char* langD "\nor get it from the free Make and Play Edition.", NULL ); - VVV_exit(1); return 0; } @@ -1331,19 +1330,6 @@ static int PLATFORM_getOSDirectory(char* output, const size_t output_size) } SDL_snprintf(output, output_size, "%s/", externalStoragePath); return 1; -#elif TARGET_OS_IPHONE - // (ab)use SDL APIs to get the path to the Documents folder without needing Objective-C - const char* prefsPath = SDL_GetPrefPath("", ""); - if (prefsPath == NULL) - { - vlog_error( - "Could not get OS directory: %s", - SDL_GetError() - ); - return 0; - } - SDL_snprintf(output, output_size, "%s/../../Documents/", prefsPath); - return 1; #else const char* prefDir = PHYSFS_getPrefDir("distractionware", "VVVVVV"); if (prefDir == NULL) diff --git a/desktop_version/src/FontBidi.cpp b/desktop_version/src/FontBidi.cpp index 6f09b3fe..5c4d948d 100644 --- a/desktop_version/src/FontBidi.cpp +++ b/desktop_version/src/FontBidi.cpp @@ -1,7 +1,6 @@ #include "FontBidi.h" #include -#include #include "Alloc.h" #include "UTF8.h" @@ -9,6 +8,7 @@ extern "C" { #include +#include } namespace font diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index d41d63c9..035070cf 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -146,7 +146,7 @@ void Game::init(void) prevroomy = 0; saverx = 0; savery = 0; - savecolour = EntityColour_CREW_CYAN; + savecolour = 0; mutebutton = 0; muted = false; @@ -225,7 +225,6 @@ void Game::init(void) ndmresulthardestroom_x = hardestroom_x; ndmresulthardestroom_y = hardestroom_y; ndmresulthardestroom_specialname = false; - nodeatheligible = false; customcol=0; @@ -254,10 +253,6 @@ void Game::init(void) levelpage=0; playcustomlevel=0; - gpmenu_lastbutton = SDL_CONTROLLER_BUTTON_INVALID; - gpmenu_confirming = false; - gpmenu_showremove = false; - silence_settings_error = false; deathcounts = 0; @@ -381,12 +376,6 @@ void Game::init(void) screenshot_border_timer = 0; screenshot_saved_success = false; -#if defined(__ANDROID__) || TARGET_OS_IPHONE - checkpoint_saving = true; -#else - checkpoint_saving = false; -#endif - setdefaultcontrollerbuttons(); } @@ -832,7 +821,7 @@ static void savetele_textbox_success(textboxclass* THIS) THIS->pad(3, 3); } -static void save_textbox_fail(textboxclass* THIS) +static void savetele_textbox_fail(textboxclass* THIS) { THIS->lines.clear(); THIS->lines.push_back(loc::gettext("ERROR: Could not save game!")); @@ -840,31 +829,6 @@ static void save_textbox_fail(textboxclass* THIS) THIS->pad(1, 1); } -void Game::show_save_fail(void) -{ - graphics.createtextboxflipme("", -1, 12, TEXT_COLOUR("red")); - graphics.textboxprintflags(PR_FONT_INTERFACE); - graphics.textboxcenterx(); - graphics.textboxtimer(50); - graphics.textboxtranslate(TEXTTRANSLATE_FUNCTION, save_textbox_fail); -} - -void Game::checkpoint_save(void) -{ - if (checkpoint_saving && !inspecial() && (!map.custommode || (map.custommode && map.custommodeforreal)) && !cliplaytest) - { - bool success = map.custommode ? customsavequick(cl.ListOfMetaData[playcustomlevel].filename) : savequick(); - gamesaved = success; - gamesavefailed = !success; - - if (gamesavefailed) - { - show_save_fail(); - graphics.textboxapplyposition(); - } - } -} - void Game::savetele_textbox(void) { if (inspecial() || map.custommode) @@ -882,7 +846,11 @@ void Game::savetele_textbox(void) } else { - show_save_fail(); + graphics.createtextboxflipme("", -1, 12, TEXT_COLOUR("red")); + graphics.textboxprintflags(PR_FONT_INTERFACE); + graphics.textboxcenterx(); + graphics.textboxtimer(50); + graphics.textboxtranslate(TEXTTRANSLATE_FUNCTION, savetele_textbox_fail); } graphics.textboxapplyposition(); } @@ -2567,7 +2535,7 @@ void Game::updatestate(void) int i = obj.getplayer(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; int j = obj.getteleporter(); @@ -2588,7 +2556,7 @@ void Game::updatestate(void) if (INBOUNDS_VEC(i, obj.entities)) { obj.entities[i].tile = 1; - obj.entities[i].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[i].colour = 101; } break; } @@ -2761,7 +2729,7 @@ void Game::updatestate(void) int i = obj.getplayer(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = true; } @@ -2775,7 +2743,7 @@ void Game::updatestate(void) if (INBOUNDS_VEC(i, obj.entities)) { obj.entities[i].tile = 1; - obj.entities[i].colour = EntityColour_TELEPORTER_INACTIVE; + obj.entities[i].colour = 100; } break; } @@ -3344,14 +3312,11 @@ void Game::updatestate(void) } } - if (nodeathmode || nodeatheligible) - { - unlockAchievement("vvvvvvmaster"); //bloody hell - unlocknum(UnlockTrophy_NODEATHMODE_COMPLETE); - } if (nodeathmode) { + unlockAchievement("vvvvvvmaster"); //bloody hell + unlocknum(UnlockTrophy_NODEATHMODE_COMPLETE); setstate(3520); setstatedelay(0); } @@ -3369,7 +3334,7 @@ void Game::updatestate(void) int i = obj.getplayer(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[i].colour = 102; } incstate(); @@ -3411,7 +3376,7 @@ void Game::updatestate(void) int i = obj.getplayer(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = true; } @@ -3496,7 +3461,7 @@ void Game::updatestate(void) int i = obj.getplayer(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = true; } @@ -3504,7 +3469,7 @@ void Game::updatestate(void) if(INBOUNDS_VEC(i, obj.entities)) { obj.entities[i].tile = 1; - obj.entities[i].colour = EntityColour_TELEPORTER_INACTIVE; + obj.entities[i].colour = 100; } break; } @@ -3548,9 +3513,9 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; @@ -3679,9 +3644,9 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; @@ -3792,9 +3757,9 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 0; @@ -3905,9 +3870,9 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; @@ -4023,9 +3988,9 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; @@ -4141,9 +4106,9 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 0; @@ -4257,7 +4222,7 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } obj.entities[i].invis = false; obj.entities[i].dir = 1; @@ -4370,9 +4335,9 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; @@ -4483,9 +4448,9 @@ void Game::updatestate(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[j].tile = 2; - obj.entities[j].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[j].colour = 101; } - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; @@ -4763,13 +4728,7 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, struct ScreenSett if (SDL_strcmp(pKey, "stretch") == 0) { - int mode = help.Int(pText); - if (mode < 0 || mode >= NUM_SCALING_MODES) - { - /* Pick a sane default. */ - mode = SCALING_INTEGER; - } - screen_settings->scalingMode = mode; + screen_settings->scalingMode = help.Int(pText); } if (SDL_strcmp(pKey, "useLinearFilter") == 0) @@ -4971,10 +4930,6 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, struct ScreenSett roomname_translator::set_enabled(help.Int(pText)); } - if (SDL_strcmp(pKey, "checkpoint_saving") == 0) - { - checkpoint_saving = help.Int(pText); - } } setdefaultcontrollerbuttons(); @@ -5233,8 +5188,6 @@ void Game::serializesettings(tinyxml2::XMLElement* dataNode, const struct Screen xml::update_tag(dataNode, "english_sprites", (int) loc::english_sprites); xml::update_tag(dataNode, "new_level_font", loc::new_level_font.c_str()); xml::update_tag(dataNode, "roomname_translator", (int) roomname_translator::enabled); - - xml::update_tag(dataNode, "checkpoint_saving", (int) checkpoint_saving); } static bool settings_loaded = false; @@ -5367,7 +5320,7 @@ void Game::deathsequence(void) } if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_DEAD; + obj.entities[i].colour = 1; obj.entities[i].invis = false; } @@ -5934,10 +5887,6 @@ void Game::customloadquick(const std::string& savfile) { map.customshowmm = help.Int(pText); } - else if (SDL_strcmp(pKey, "mapreveal") == 0) - { - map.revealmap = help.Int(pText); - } else if (SDL_strcmp(pKey, "disabletemporaryaudiopause") == 0) { disabletemporaryaudiopause = help.Int(pText); @@ -5952,48 +5901,6 @@ void Game::customloadquick(const std::string& savfile) map.roomnameset = true; map.roomname_special = true; } - else if (SDL_strcmp(pKey, "currentregion") == 0) - { - map.currentregion = help.Int(pText); - } - else if (SDL_strcmp(pKey, "regions") == 0) - { - tinyxml2::XMLElement* pElem2; - for (pElem2 = pElem->FirstChildElement(); pElem2 != NULL; pElem2 = pElem2->NextSiblingElement()) - { - int thisid = 0; - int thisrx = 0; - int thisry = 0; - int thisrx2 = (cl.mapwidth - 1); - int thisry2 = (cl.mapheight - 1); - if (pElem2->Attribute("id")) - { - thisid = help.Int(pElem2->Attribute("id")); - } - - for (tinyxml2::XMLElement* pElem3 = pElem2->FirstChildElement(); pElem3 != NULL; pElem3 = pElem3->NextSiblingElement()) - { - if (SDL_strcmp(pElem3->Value(), "rx") == 0 && pElem3->GetText() != NULL) - { - thisrx = help.Int(pElem3->GetText()); - } - if (SDL_strcmp(pElem3->Value(), "ry") == 0 && pElem3->GetText() != NULL) - { - thisry = help.Int(pElem3->GetText()); - } - if (SDL_strcmp(pElem3->Value(), "rx2") == 0 && pElem3->GetText() != NULL) - { - thisrx2 = help.Int(pElem3->GetText()); - } - if (SDL_strcmp(pElem3->Value(), "ry2") == 0 && pElem3->GetText() != NULL) - { - thisry2 = help.Int(pElem3->GetText()); - } - } - - map.setregion(thisid, thisrx, thisry, thisrx2, thisry2); - } - } } } @@ -6378,41 +6285,6 @@ bool Game::customsavequick(const std::string& savfile) xml::update_tag(msgs, "crewmates", crewmates()); - xml::update_tag(msgs, "currentregion", map.currentregion); - - tinyxml2::XMLElement* msg = xml::update_element_delete_contents(msgs, "regions"); - for (size_t i = 0; i < SDL_arraysize(map.region); i++) - { - if (map.region[i].isvalid) - { - tinyxml2::XMLElement* region_el; - region_el = doc.NewElement("region"); - - region_el->SetAttribute("id", (help.String(i).c_str())); - - tinyxml2::XMLElement* rx_el; - rx_el = doc.NewElement("rx"); - rx_el->LinkEndChild(doc.NewText(help.String(map.region[i].rx).c_str())); - region_el->LinkEndChild(rx_el); - - tinyxml2::XMLElement* ry_el; - ry_el = doc.NewElement("ry"); - ry_el->LinkEndChild(doc.NewText(help.String(map.region[i].ry).c_str())); - region_el->LinkEndChild(ry_el); - - tinyxml2::XMLElement* rx2_el; - rx2_el = doc.NewElement("rx2"); - rx2_el->LinkEndChild(doc.NewText(help.String(map.region[i].rx2).c_str())); - region_el->LinkEndChild(rx2_el); - - tinyxml2::XMLElement* ry2_el; - ry2_el = doc.NewElement("ry2"); - ry2_el->LinkEndChild(doc.NewText(help.String(map.region[i].ry2).c_str())); - region_el->LinkEndChild(ry2_el); - - msg->LinkEndChild(region_el); - } - } //Special stats @@ -6454,8 +6326,6 @@ bool Game::customsavequick(const std::string& savfile) xml::update_tag(msgs, "showminimap", (int) map.customshowmm); - xml::update_tag(msgs, "mapreveal", (int) map.revealmap); - xml::update_tag(msgs, "disabletemporaryaudiopause", (int) disabletemporaryaudiopause); xml::update_tag(msgs, "showtrinkets", (int) map.showtrinkets); @@ -6976,7 +6846,6 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) option(loc::gettext("unfocus pause")); option(loc::gettext("unfocus audio pause")); option(loc::gettext("room name background")); - option(loc::gettext("checkpoint saving")); option(loc::gettext("return")); menuyoff = 0; maxspacing = 15; @@ -7013,7 +6882,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) option(loc::gettext("bind restart")); option(loc::gettext("bind interact"), separate_interact); option(loc::gettext("return")); - menuyoff = 12; + menuyoff = 0; maxspacing = 10; break; case Menu::language: @@ -7893,11 +7762,6 @@ void Game::returntoingame(void) } } DEFER_CALLBACK(nextbgcolor); - - if (nocompetitive()) - { - invalidate_ndm_trophy(); - } } void Game::unlockAchievement(const char* name) @@ -7950,22 +7814,8 @@ void Game::copyndmresults(void) SDL_memcpy(ndmresultcrewstats, crewstats, sizeof(ndmresultcrewstats)); } -void Game::invalidate_ndm_trophy(void) +static inline int get_framerate(const int slowdown) { - if (nodeatheligible) - { - vlog_debug("NDM trophy is invalidated!"); - } - nodeatheligible = false; -} - -static inline int get_framerate(const int slowdown, const int deathseq) -{ - if (deathseq != -1) - { - return 34; - } - switch (slowdown) { case 30: @@ -7994,7 +7844,7 @@ int Game::get_timestep(void) switch (gamestate) { case GAMEMODE: - return get_framerate(slowdown, deathseq); + return get_framerate(slowdown); default: return 34; } diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index b053d1b4..362a956c 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -225,8 +225,6 @@ public: void crewmate_textbox(const int color); void remaining_textbox(void); void actionprompt_textbox(void); - void show_save_fail(void); - void checkpoint_save(void); void savetele_textbox(void); void setstate(int gamestate); @@ -365,7 +363,6 @@ public: int savetrinkets; bool startscript; std::string newscript; - bool checkpoint_saving; bool menustart; @@ -404,10 +401,6 @@ public: int creditposx, creditposy, creditposdelay; int oldcreditposx; - SDL_GameControllerButton gpmenu_lastbutton; - bool gpmenu_confirming; - bool gpmenu_showremove; - bool silence_settings_error; @@ -439,8 +432,6 @@ public: int ndmresulthardestroom_y; bool ndmresulthardestroom_specialname; void copyndmresults(void); - bool nodeatheligible; - void invalidate_ndm_trophy(void); //Time Trials bool intimetrial, timetrialparlost; diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 6df6c6f7..ed5c93f1 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -12,7 +12,6 @@ #include "FileSystemUtils.h" #include "Font.h" #include "GraphicsUtil.h" -#include "IMERender.h" #include "Localization.h" #include "Map.h" #include "Maths.h" @@ -425,23 +424,22 @@ void Graphics::print_level_creator( int width_for_face = 17; int total_width = width_for_face + font::len(print_flags, creator.c_str()); int face_x, text_x, sprite_x; - int offset_x = -7; if (!font::is_rtl(print_flags)) { face_x = (SCREEN_WIDTH_PIXELS - total_width) / 2; text_x = face_x + width_for_face; - sprite_x = 0; + sprite_x = 7; } else { face_x = (SCREEN_WIDTH_PIXELS + total_width) / 2; text_x = face_x - width_for_face; face_x -= 10; // sprite origin - sprite_x = 96; + sprite_x = 103; print_flags |= PR_RIGHT; } set_texture_color_mod(grphx.im_sprites, r, g, b); - draw_texture_part(grphx.im_sprites, face_x + offset_x, y - 3, sprite_x, 0, 24, 12, 1, 1); + draw_texture_part(grphx.im_sprites, face_x, y - 1, sprite_x, 2, 10, 10, 1, 1); set_texture_color_mod(grphx.im_sprites, 255, 255, 255); font::print(print_flags, text_x, y, creator, r, g, b); } @@ -930,20 +928,13 @@ void Graphics::drawgui(void) size_t j; for (j = 0; j < textboxes[i].lines.size(); j++) { - const int x = text_xp; - const int y = yp + text_yoff + text_sign * (j * (font_height + textboxes[i].linegap)); - if (!textboxes[i].force_outline) - { - font::print(print_flags | PR_BOR, x, y, textbox_line(buffer, sizeof(buffer), i, j), 0, 0, 0); - } - else if (textboxes[i].outline) - { - // We're forcing an outline, so we'll have to draw it ourselves instead of relying on PR_BOR. - font::print(print_flags, x - 1, y, textbox_line(buffer, sizeof(buffer), i, j), 0, 0, 0); - font::print(print_flags, x + 1, y, textbox_line(buffer, sizeof(buffer), i, j), 0, 0, 0); - font::print(print_flags, x, y - 1, textbox_line(buffer, sizeof(buffer), i, j), 0, 0, 0); - font::print(print_flags, x, y + 1, textbox_line(buffer, sizeof(buffer), i, j), 0, 0, 0); - } + font::print( + print_flags | PR_BOR, + text_xp, + yp + text_yoff + text_sign * (j * (font_height + textboxes[i].linegap)), + textbox_line(buffer, sizeof(buffer), i, j), + 0, 0, 0 + ); } for (j = 0; j < textboxes[i].lines.size(); j++) { @@ -1279,15 +1270,6 @@ void Graphics::draw_grid_tile( draw_grid_tile(texture, t, x, y, width, height, color, 1, 1); } -void Graphics::draw_region_image(int t, int xp, int yp, int wp, int hp) -{ - if (!INBOUNDS_ARR(t, customminimaps) || customminimaps[t] == NULL) - { - return; - } - draw_texture_part(customminimaps[t], xp, yp, 0, 0, wp, hp, 1, 1); -} - void Graphics::cutscenebars(void) { const int usethispos = lerp(oldcutscenebarspos, cutscenebarspos); @@ -1491,18 +1473,6 @@ void Graphics::setimage(TextboxImage image) textboxes[m].setimage(image); } -void Graphics::textboxoutline(bool enabled) -{ - if (!INBOUNDS_VEC(m, textboxes)) - { - vlog_error("textboxoutline() out-of-bounds!"); - return; - } - - textboxes[m].force_outline = true; - textboxes[m].outline = enabled; -} - void Graphics::addline( const std::string& t ) { if (!INBOUNDS_VEC(m, textboxes)) @@ -1865,12 +1835,53 @@ void Graphics::drawgravityline(const int t, const int x, const int y, const int return; } - if (w <= 0 && h <= 0) + if (obj.entities[t].life == 0) { - return; - } + if (game.noflashingmode) + { + set_color(200 - 20, 200 - 20, 200 - 20); + draw_line(x, y, x + w, y + h); + return; + } - set_color(obj.entities[t].realcol); + switch(linestate) + { + case 0: + set_color(200 - 20, 200 - 20, 200 - 20); + break; + case 1: + set_color(245 - 30, 245 - 30, 225 - 30); + break; + case 2: + set_color(225 - 30, 245 - 30, 245 - 30); + break; + case 3: + set_color(200 - 20, 200 - 20, 164 - 10); + break; + case 4: + set_color(196 - 20, 255 - 30, 224 - 20); + break; + case 5: + set_color(196 - 20, 235 - 30, 205 - 20); + break; + case 6: + set_color(164 - 10, 164 - 10, 164 - 10); + break; + case 7: + set_color(205 - 20, 245 - 30, 225 - 30); + break; + case 8: + set_color(225 - 30, 255 - 30, 205 - 20); + break; + case 9: + set_color(245 - 30, 245 - 30, 245 - 30); + break; + } + } + else + { + set_color(96, 96, 96); + } draw_line(x, y, x + w, y + h); } @@ -3039,49 +3050,8 @@ SDL_Color Graphics::getcol( int t ) case 23: // Enemy : Indicator Gray return getRGB(255 - help.glow / 2 - (int) (GETCOL_RANDOM * 40), 255 - help.glow/2 - (int) (GETCOL_RANDOM * 40), 255 - help.glow/2 - (int) (GETCOL_RANDOM * 40)); - case 24: // Gravity line (Inactive) - return getRGB(96, 96, 96); - case 25: // Gravity line (Active) - if (game.noflashingmode) - { - return getRGB(200 - 20, 200 - 20, 200 - 20); - } - - switch (linestate) - { - default: - case 0: - return getRGB(200 - 20, 200 - 20, 200 - 20); - case 1: - return getRGB(245 - 30, 245 - 30, 225 - 30); - case 2: - return getRGB(225 - 30, 245 - 30, 245 - 30); - case 3: - return getRGB(200 - 20, 200 - 20, 164 - 10); - case 4: - return getRGB(196 - 20, 255 - 30, 224 - 20); - case 5: - return getRGB(196 - 20, 235 - 30, 205 - 20); - case 6: - return getRGB(164 - 10, 164 - 10, 164 - 10); - case 7: - return getRGB(205 - 20, 245 - 30, 225 - 30); - case 8: - return getRGB(225 - 30, 255 - 30, 205 - 20); - case 9: - return getRGB(245 - 30, 245 - 30, 245 - 30); - } - case 26: // Coin - if (game.noflashingmode) - { - return getRGB(234, 234, 10); - } - return getRGB(250 - (int) (GETCOL_RANDOM * 32), 250 - (int) (GETCOL_RANDOM * 32), 10); - case 27: // Particle flashy red - return getRGB((GETCOL_RANDOM * 64), 10, 10); - - // Trophies - // cyan + // Trophies + // cyan case 30: return RGBf(160, 200, 220); // Purple @@ -3198,17 +3168,30 @@ void Graphics::menuoffrender(void) } } -void Graphics::textboxabsolutepos(int x, int y) +SDL_Color Graphics::huetilegetcol() { - if (!INBOUNDS_VEC(m, textboxes)) + if (game.noflashingmode) { - vlog_error("textboxabsolutepos() out-of-bounds!"); - return; + return getRGB(234, 234, 10); } - textboxes[m].position_absolute = true; - textboxes[m].xp = x; - textboxes[m].yp = y; + return getRGB(250 - (int) (fRandom() * 32), 250 - (int) (fRandom() * 32), 10); +} + +SDL_Color Graphics::bigchunkygetcol(int t) +{ + // A seperate index of colours, for simplicity + float random = game.noflashingmode ? 0.5 : fRandom(); + + switch (t) + { + case 1: + return getRGB(random * 64, 10, 10); + case 2: + return getRGB(160 - help.glow / 2 - (int) (random * 20), 200 - help.glow / 2, 220 - help.glow); + } + const SDL_Color color = {0, 0, 0, 0}; + return color; } void Graphics::textboxcenterx(void) @@ -3402,7 +3385,6 @@ static void commsrelay_textbox(textboxclass* THIS) THIS->wrap(11); THIS->resize(); THIS->xp = 224 - THIS->w; - THIS->yp = 32 - THIS->h/2; } void Graphics::textboxcommsrelay(const char* text) @@ -3424,19 +3406,19 @@ int Graphics::crewcolour(const int t) switch (t) { case 0: - return EntityColour_CREW_CYAN; + return CYAN; case 1: - return EntityColour_CREW_PURPLE; + return PURPLE; case 2: - return EntityColour_CREW_YELLOW; + return YELLOW; case 3: - return EntityColour_CREW_RED; + return RED; case 4: - return EntityColour_CREW_GREEN; + return GREEN; case 5: - return EntityColour_CREW_BLUE; + return BLUE; default: - return EntityColour_CREW_CYAN; + return 0; } } @@ -3535,22 +3517,11 @@ void Graphics::get_stretch_info(SDL_Rect* rect) rect->w = width; rect->h = height; break; - default: - SDL_assert(0 && "Invalid scaling mode!"); - rect->x = 0; - rect->y = 0; - rect->w = width; - rect->h = height; } - - // In case anything accidentally set the width/height to 0, we'll clamp it to avoid crashing from a division by 0 - rect->w = SDL_max(1, rect->w); - rect->h = SDL_max(1, rect->h); } void Graphics::render(void) { - ime_render(); draw_screenshot_border(); if (gameScreen.badSignalEffect) @@ -3563,12 +3534,10 @@ void Graphics::render(void) draw_window_background(); - SDL_Rect stretch_info; - get_stretch_info(&stretch_info); + SDL_Rect rect; + get_stretch_info(&rect); - ime_set_rect(&stretch_info); - - copy_texture(gameTexture, NULL, &stretch_info, 0, NULL, flipmode ? SDL_FLIP_VERTICAL : SDL_FLIP_NONE); + copy_texture(gameTexture, NULL, &rect, 0, NULL, flipmode ? SDL_FLIP_VERTICAL : SDL_FLIP_NONE); } void Graphics::renderwithscreeneffects(void) diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index b9c9a53f..c37622a2 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -40,54 +40,6 @@ enum ImageNames #define FADEMODE_IS_FADING(mode) ((mode) != FADE_NONE && (mode) != FADE_FULLY_BLACK) -enum EntityColour -{ - EntityColour_CREW_CYAN = 0, - EntityColour_DEAD = 1, - EntityColour_ENEMY_DARK_ORANGE = 2, - EntityColour_TRINKET = 3, - EntityColour_INACTIVE_ENTITY = 4, - EntityColour_ACTIVE_ENTITY = 5, - EntityColour_ENEMY_RED = 6, - EntityColour_ENEMY_GREEN = 7, - EntityColour_ENEMY_PINK = 8, - EntityColour_ENEMY_YELLOW = 9, - EntityColour_WARP_TOKEN = 10, - EntityColour_ENEMY_CYAN = 11, - EntityColour_ENEMY_BLUE = 12, - EntityColour_CREW_GREEN = 13, - EntityColour_CREW_YELLOW = 14, - EntityColour_CREW_RED = 15, - EntityColour_CREW_BLUE = 16, - EntityColour_ENEMY_ORANGE = 17, - EntityColour_ENEMY_GRAY = 18, - - EntityColour_CREW_GRAY = 19, // Despite the comment in the color code saying this is for enemies, it's used as a fallback for crew colors. - - EntityColour_CREW_PURPLE = 20, - EntityColour_ENEMY_GRAVITRON = 21, - EntityColour_ENEMY_LIGHT_GRAY = 22, - EntityColour_GRAVITRON_INDICATOR = 23, - EntityColour_GRAVITY_LINE_TOUCHED = 24, - EntityColour_GRAVITY_LINE_ACTIVE = 25, - EntityColour_COIN = 26, - EntityColour_PARTICLE_RED = 27, - EntityColour_TROPHY_FINAL_LEVEL = 30, - EntityColour_TROPHY_SPACE_STATION_1 = 31, - EntityColour_TROPHY_SPACE_STATION_2 = 32, - EntityColour_TROPHY_TOWER = 33, - EntityColour_TROPHY_WARP_ZONE = 34, - EntityColour_TROPHY_LABORATORY = 35, - EntityColour_TROPHY_GOLD = 36, - EntityColour_TROPHY_GAME_COMPLETE = 37, - EntityColour_TROPHY_SILVER = 38, - EntityColour_TROPHY_BRONZE = 39, - EntityColour_TROPHY_FLASHY = 40, - EntityColour_TELEPORTER_INACTIVE = 100, - EntityColour_TELEPORTER_ACTIVE = 101, - EntityColour_TELEPORTER_FLASHING = 102 -}; - class Graphics { public: @@ -99,6 +51,9 @@ public: GraphicsResources grphx; + SDL_Color huetilegetcol(); + SDL_Color bigchunkygetcol(int t); + void drawgravityline(int t, int x, int y, int w, int h); void drawcoloredtile(int x, int y, int t, int r, int g, int b); @@ -139,8 +94,6 @@ public: int r, int g, int b ); - void textboxabsolutepos(int x, int y); - void textboxcenterx(void); int textboxwidth(void); @@ -182,8 +135,6 @@ public: void setimage(TextboxImage image); - void textboxoutline(bool enabled); - void textboxindex(int index); void textboxremove(void); @@ -221,8 +172,6 @@ public: void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, SDL_Color color, int scalex, int scaley); void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, SDL_Color color); - void draw_region_image(int t, int xp, int yp, int wp, int hp); - void updatetextboxes(void); const char* textbox_line(char* buffer, size_t buffer_len, size_t textbox_i, size_t line_i); void drawgui(void); @@ -388,8 +337,6 @@ public: SDL_Texture* images[NUM_IMAGES]; - SDL_Texture* customminimaps[401]; - bool flipmode; bool setflipmode; bool notextoutline; diff --git a/desktop_version/src/GraphicsResources.cpp b/desktop_version/src/GraphicsResources.cpp index 8d13f8df..571a1f00 100644 --- a/desktop_version/src/GraphicsResources.cpp +++ b/desktop_version/src/GraphicsResources.cpp @@ -442,33 +442,6 @@ void GraphicsResources::init(void) SDL_assert(0 && "Failed to create minimap texture! See stderr."); return; } - - SDL_zeroa(graphics.customminimaps); - - EnumHandle handle = {}; - const char* item; - char full_item[64]; - while ((item = FILESYSTEM_enumerateAssets("graphics", &handle)) != NULL) - { - if (SDL_strncmp(item, "region", 6) != 0) - { - continue; - } - char* end; - int i = SDL_strtol(&item[6], &end, 10); - // make sure the region id is actually in bounds! - if (i < 1 || i > 400) - { - continue; - } - if (item == end || SDL_strcmp(end, ".png") != 0) - { - continue; - } - SDL_snprintf(full_item, sizeof(full_item), "graphics/%s", item); - graphics.customminimaps[i] = LoadImage(full_item); - } - FILESYSTEM_freeEnumerate(&handle); } @@ -503,11 +476,6 @@ void GraphicsResources::destroy(void) CLEAR(im_sprites_translated); CLEAR(im_flipsprites_translated); - - for (size_t i = 0; i < SDL_arraysize(graphics.customminimaps); i++) - { - CLEAR(graphics.customminimaps[i]); - } #undef CLEAR VVV_freefunc(SDL_FreeSurface, im_sprites_surf); diff --git a/desktop_version/src/GraphicsUtil.cpp b/desktop_version/src/GraphicsUtil.cpp index 33ffb256..55e89b1a 100644 --- a/desktop_version/src/GraphicsUtil.cpp +++ b/desktop_version/src/GraphicsUtil.cpp @@ -189,15 +189,8 @@ void UpdateFilter(void) } } -static bool disabled_filter = false; - void ApplyFilter(SDL_Surface** src, SDL_Surface** dest) { - if (disabled_filter) - { - return; - } - if (src == NULL || dest == NULL) { SDL_assert(0 && "NULL src or dest!"); @@ -221,9 +214,7 @@ void ApplyFilter(SDL_Surface** src, SDL_Surface** dest) const int result = SDL_RenderReadPixels(gameScreen.m_renderer, NULL, 0, (*src)->pixels, (*src)->pitch); if (result != 0) { - disabled_filter = true; - VVV_freefunc(SDL_FreeSurface, *src); - VVV_freefunc(SDL_FreeSurface, *dest); + SDL_FreeSurface(*src); WHINE_ONCE_ARGS(("Could not read pixels from renderer: %s", SDL_GetError())); return; } diff --git a/desktop_version/src/IMERender.cpp b/desktop_version/src/IMERender.cpp deleted file mode 100644 index 5771c33b..00000000 --- a/desktop_version/src/IMERender.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#include - -#include "Constants.h" -#include "Font.h" -#include "Graphics.h" -#include "KeyPoll.h" -#include "UTF8.h" - -static bool render_done = false; -static SDL_Rect imebox; - -void ime_render(void) -{ - render_done = false; - - if (!SDL_IsTextInputActive() || key.imebuffer == "") - { - return; - } - - int fontheight = font::height(PR_FONT_LEVEL); - imebox.x = 8; - imebox.y = SCREEN_HEIGHT_PIXELS - 32 - fontheight; - imebox.w = font::len(PR_FONT_LEVEL, key.imebuffer.c_str()) + 1; - imebox.h = fontheight + 1; - - SDL_Rect imebox_border = imebox; - imebox_border.x -= 1; - imebox_border.y -= 1; - imebox_border.w += 2; - imebox_border.h += 2; - - graphics.fill_rect(&imebox_border, 128, 128, 128); - graphics.fill_rect(&imebox, 0, 0, 0); - - if (key.imebuffer_length > 0) - { - /* Also show a selection, so we need to know where and how long it is... - * Because SDL gives us the number of "characters" (so, codepoints)... */ - const char* imebuffer_ptr = key.imebuffer.c_str(); - const char* sel_start_ptr = imebuffer_ptr; - for (int i = 0; i < key.imebuffer_start; i++) - { - if (UTF8_next(&sel_start_ptr) == 0) - { - // Already past the '\0'... - sel_start_ptr--; - break; - } - } - const char* sel_end_ptr = sel_start_ptr; - for (int i = 0; i < key.imebuffer_length; i++) - { - if (UTF8_next(&sel_end_ptr) == 0) - { - break; - } - } - size_t before_sel_nbytes = sel_start_ptr - imebuffer_ptr; - size_t in_sel_nbytes = sel_end_ptr - sel_start_ptr; - char* before_sel = (char*) SDL_malloc(before_sel_nbytes + 1); - char* in_sel = (char*) SDL_malloc(in_sel_nbytes + 1); - if (before_sel != NULL && in_sel != NULL) - { - SDL_memcpy(before_sel, imebuffer_ptr, before_sel_nbytes); - before_sel[before_sel_nbytes] = '\0'; - SDL_memcpy(in_sel, sel_start_ptr, in_sel_nbytes); - in_sel[in_sel_nbytes] = '\0'; - - int before_sel_pixels = font::len(PR_FONT_LEVEL, before_sel) - 1; - int in_sel_pixels = font::len(PR_FONT_LEVEL, in_sel); - if (in_sel_pixels > 0) - { - in_sel_pixels += 1; - } - - SDL_Rect selrect = imebox; - selrect.x += before_sel_pixels + 1; - selrect.w = in_sel_pixels; - graphics.fill_rect(&selrect, 128, 64, 0); - } - SDL_free(before_sel); - SDL_free(in_sel); - } - - font::print(PR_FONT_LEVEL | PR_CJK_LOW, imebox.x + 1, imebox.y + 1, key.imebuffer, 255, 255, 255); - - render_done = true; -} - -void ime_set_rect(SDL_Rect* stretch_info) -{ - if (!render_done) - { - return; - } - - SDL_Rect imebox_scaled = imebox; - float x_scale = (float) stretch_info->w / SCREEN_WIDTH_PIXELS; - float y_scale = (float) stretch_info->h / SCREEN_HEIGHT_PIXELS; - imebox_scaled.x *= x_scale; - imebox_scaled.y *= y_scale; - imebox_scaled.w *= x_scale; - imebox_scaled.h *= y_scale; - imebox_scaled.x += stretch_info->x; - imebox_scaled.y += stretch_info->y; - - SDL_SetTextInputRect(&imebox_scaled); -} diff --git a/desktop_version/src/IMERender.h b/desktop_version/src/IMERender.h deleted file mode 100644 index 9e48ebd1..00000000 --- a/desktop_version/src/IMERender.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef IMERENDER_H -#define IMERENDER_H - -void ime_render(void); -void ime_set_rect(SDL_Rect* stretch_info); - -#endif /* IMERENDER_H */ diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 4ee34af7..aab9a9a6 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -35,37 +35,6 @@ static void updatebuttonmappings(int bind) ) { if (key.isDown(i)) { - if (!game.gpmenu_confirming || i != game.gpmenu_lastbutton) - { - game.gpmenu_confirming = true; - game.gpmenu_lastbutton = i; - - // Is this button already in the list for this action? - std::vector* vec = NULL; - switch (bind) - { - case 1: vec = &game.controllerButton_flip; break; - case 2: vec = &game.controllerButton_map; break; - case 3: vec = &game.controllerButton_esc; break; - case 4: vec = &game.controllerButton_restart; break; - case 5: vec = &game.controllerButton_interact; break; - default: return; - } - - game.gpmenu_showremove = false; - for (size_t j = 0; j < vec->size(); j += 1) - { - if (i == (*vec)[j]) - { - game.gpmenu_showremove = true; - break; - } - } - - return; - } - game.gpmenu_confirming = false; - bool dupe = false; switch (bind) { @@ -77,14 +46,13 @@ static void updatebuttonmappings(int bind) if (i == game.controllerButton_flip[j]) { dupe = true; - game.controllerButton_flip.erase(game.controllerButton_flip.begin() + j); } } if (!dupe) { game.controllerButton_flip.push_back(i); + music.playef(Sound_VIRIDIAN); } - music.playef(Sound_VIRIDIAN); for (j = 0; j < game.controllerButton_map.size(); j += 1) { if (i == game.controllerButton_map[j]) @@ -123,14 +91,13 @@ static void updatebuttonmappings(int bind) if (i == game.controllerButton_map[j]) { dupe = true; - game.controllerButton_map.erase(game.controllerButton_map.begin() + j); } } if (!dupe) { game.controllerButton_map.push_back(i); + music.playef(Sound_VIRIDIAN); } - music.playef(Sound_VIRIDIAN); for (j = 0; j < game.controllerButton_flip.size(); j += 1) { if (i == game.controllerButton_flip[j]) @@ -169,14 +136,13 @@ static void updatebuttonmappings(int bind) if (i == game.controllerButton_esc[j]) { dupe = true; - game.controllerButton_esc.erase(game.controllerButton_esc.begin() + j); } } if (!dupe) { game.controllerButton_esc.push_back(i); + music.playef(Sound_VIRIDIAN); } - music.playef(Sound_VIRIDIAN); for (j = 0; j < game.controllerButton_flip.size(); j += 1) { if (i == game.controllerButton_flip[j]) @@ -215,14 +181,13 @@ static void updatebuttonmappings(int bind) if (i == game.controllerButton_restart[j]) { dupe = true; - game.controllerButton_restart.erase(game.controllerButton_restart.begin() + j); } } if (!dupe) { game.controllerButton_restart.push_back(i); + music.playef(Sound_VIRIDIAN); } - music.playef(Sound_VIRIDIAN); for (j = 0; j < game.controllerButton_flip.size(); j += 1) { if (i == game.controllerButton_flip[j]) @@ -261,14 +226,13 @@ static void updatebuttonmappings(int bind) if (i == game.controllerButton_interact[j]) { dupe = true; - game.controllerButton_interact.erase(game.controllerButton_interact.begin() + j); } } if (!dupe) { game.controllerButton_interact.push_back(i); + music.playef(Sound_VIRIDIAN); } - music.playef(Sound_VIRIDIAN); for (j = 0; j < game.controllerButton_flip.size(); j += 1) { if (i == game.controllerButton_flip[j]) @@ -898,12 +862,6 @@ static void menuactionpress(void) game.savestatsandsettings_menu(); music.playef(Sound_VIRIDIAN); break; - case 3: - // toggle checkpoint saving - game.checkpoint_saving = !game.checkpoint_saving; - game.savestatsandsettings_menu(); - music.playef(Sound_VIRIDIAN); - break; default: //back music.playef(Sound_VIRIDIAN); @@ -2413,26 +2371,17 @@ void titleinput(void) game.jumpheld = true; } - static bool controller_held = false; - if ( game.currentmenuname == Menu::controller && game.currentmenuoption > 0 && game.currentmenuoption < 6 && (game.separate_interact || game.currentmenuoption < 5) && key.controllerButtonDown() ) { - if (!controller_held) - { - controller_held = true; - updatebuttonmappings(game.currentmenuoption); - game.savestatsandsettings_menu(); - } + updatebuttonmappings(game.currentmenuoption); + music.playef(Sound_VIRIDIAN); + game.savestatsandsettings_menu(); return; } - else - { - controller_held = false; - } if (game.menustart && game.menucountdown <= 0 @@ -2562,11 +2511,6 @@ void titleinput(void) { game.currentmenuoption++; } - - if (game.currentmenuname == Menu::controller && (game.press_left || game.press_right)) - { - game.gpmenu_confirming = false; - } } else { @@ -2673,7 +2617,6 @@ void gameinput(void) || !game.glitchrunkludge) { game.state++; - game.unlockstate(); } game.jumpheld = true; game.glitchrunkludge=true; @@ -2778,14 +2721,14 @@ void gameinput(void) int player = obj.getplayer(); if (INBOUNDS_VEC(player, obj.entities)) { - obj.entities[player].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[player].colour = 102; } int teleporter = obj.getteleporter(); if (INBOUNDS_VEC(teleporter, obj.entities)) { obj.entities[teleporter].tile = 6; - obj.entities[teleporter].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[teleporter].colour = 102; } //which teleporter script do we use? it depends on the companion! game.setstate(4000); @@ -2809,16 +2752,16 @@ void gameinput(void) int player = obj.getplayer(); if (INBOUNDS_VEC(player, obj.entities)) { - obj.entities[player].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[player].colour = 102; } int companion = obj.getcompanion(); - if(INBOUNDS_VEC(companion, obj.entities)) obj.entities[companion].colour = EntityColour_TELEPORTER_FLASHING; + if(INBOUNDS_VEC(companion, obj.entities)) obj.entities[companion].colour = 102; int teleporter = obj.getteleporter(); if (INBOUNDS_VEC(teleporter, obj.entities)) { obj.entities[teleporter].tile = 6; - obj.entities[teleporter].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[teleporter].colour = 102; } //which teleporter script do we use? it depends on the companion! game.setstate(3000); @@ -3282,7 +3225,7 @@ static void mapmenuactionpress(const bool version2_2) int i = obj.getplayer(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[i].colour = 102; } //which teleporter script do we use? it depends on the companion! @@ -3504,14 +3447,14 @@ void teleporterinput(void) int i = obj.getplayer(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[i].colour = 102; } i = obj.getteleporter(); if (INBOUNDS_VEC(i, obj.entities)) { obj.entities[i].tile = 6; - obj.entities[i].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[i].colour = 102; } //which teleporter script do we use? it depends on the companion! game.setstate(4000); diff --git a/desktop_version/src/KeyPoll.cpp b/desktop_version/src/KeyPoll.cpp index 4439d470..b56b9d47 100644 --- a/desktop_version/src/KeyPoll.cpp +++ b/desktop_version/src/KeyPoll.cpp @@ -50,10 +50,7 @@ KeyPoll::KeyPoll(void) // 0..5 sensitivity = 2; - keybuffer = ""; - imebuffer = ""; - imebuffer_start = 0; - imebuffer_length = 0; + keybuffer=""; leftbutton=0; rightbutton=0; middlebutton=0; mousex = 0; mousey = 0; @@ -67,19 +64,13 @@ KeyPoll::KeyPoll(void) void KeyPoll::enabletextentry(void) { - keybuffer = ""; - imebuffer = ""; - imebuffer_start = 0; - imebuffer_length = 0; + keybuffer=""; SDL_StartTextInput(); } void KeyPoll::disabletextentry(void) { SDL_StopTextInput(); - imebuffer = ""; - imebuffer_start = 0; - imebuffer_length = 0; } bool KeyPoll::textentry(void) @@ -330,17 +321,6 @@ void KeyPoll::Poll(void) keybuffer += evt.text.text; } break; - case SDL_TEXTEDITING: - imebuffer = evt.edit.text; - imebuffer_start = evt.edit.start; - imebuffer_length = evt.edit.length; - break; - case SDL_TEXTEDITING_EXT: - imebuffer = evt.editExt.text; - imebuffer_start = evt.editExt.start; - imebuffer_length = evt.editExt.length; - SDL_free(evt.editExt.text); - break; /* Mouse Input */ case SDL_MOUSEMOTION: @@ -571,20 +551,8 @@ void KeyPoll::Poll(void) SDL_Rect rect; graphics.get_stretch_info(&rect); - int window_width; - int window_height; - SDL_GetWindowSizeInPixels(gameScreen.m_window, &window_width, &window_height); - - int scaled_window_width; - int scaled_window_height; - SDL_GetWindowSize(gameScreen.m_window, &scaled_window_width, &scaled_window_height); - - float scale_x = (float)window_width / (float)scaled_window_width; - float scale_y = (float)window_height / (float)scaled_window_height; - - // Use screen stretch information to modify the coordinates (as we implement stretching manually) - mousex = ((raw_mousex * scale_x) - rect.x) * SCREEN_WIDTH_PIXELS / rect.w; - mousey = ((raw_mousey * scale_y) - rect.y) * SCREEN_HEIGHT_PIXELS / rect.h; + mousex = (raw_mousex - rect.x) * SCREEN_WIDTH_PIXELS / rect.w; + mousey = (raw_mousey - rect.y) * SCREEN_HEIGHT_PIXELS / rect.h; active_input_device_changed = keyboard_was_active != BUTTONGLYPHS_keyboard_is_active(); should_recompute_textboxes |= active_input_device_changed; diff --git a/desktop_version/src/KeyPoll.h b/desktop_version/src/KeyPoll.h index d51a6b26..5718ebf0 100644 --- a/desktop_version/src/KeyPoll.h +++ b/desktop_version/src/KeyPoll.h @@ -69,9 +69,6 @@ public: bool textentry(void); bool pressedbackspace; std::string keybuffer; - std::string imebuffer; - int imebuffer_start; - int imebuffer_length; bool linealreadyemptykludge; diff --git a/desktop_version/src/LevelDebugger.cpp b/desktop_version/src/LevelDebugger.cpp index ff16badb..b0f64810 100644 --- a/desktop_version/src/LevelDebugger.cpp +++ b/desktop_version/src/LevelDebugger.cpp @@ -282,11 +282,11 @@ namespace level_debugger graphics.draw_rect(bounding_box.x, bounding_box.y, bounding_box.w, bounding_box.h, graphics.getRGB(15, 90, 90)); // For gravity lines, show the true hitbox. - if (obj.entities[i].type == EntityType_HORIZONTAL_GRAVITY_LINE) + if (obj.entities[i].type == 9) { graphics.draw_rect(bounding_box.x - 1, bounding_box.y + 1, bounding_box.w + 2, bounding_box.h, graphics.getRGB(90, 90, 15)); } - else if (obj.entities[i].type == EntityType_VERTICAL_GRAVITY_LINE) + else if (obj.entities[i].type == 10) { graphics.fill_rect(bounding_box.x - 2, bounding_box.y - 1, bounding_box.w + 1, bounding_box.h + 2, graphics.getRGB(90, 90, 15)); } @@ -390,35 +390,33 @@ namespace level_debugger // Mostly contains duplicates, but for ease of use switch (entity->type) { - case EntityType_PLAYER: + case 0: // Player render_info(line++, "Gravity", help.String(game.gravitycontrol)); render_info(line++, "Checkpoint", help.String(game.savepoint)); break; - case EntityType_MOVING: + case 1: // Moving platforms and enemies render_info(line++, "Speed", help.String(entity->para)); render_info(line++, "Movement type", help.String(entity->behave)); break; - case EntityType_TRINKET: + case 7: // Trinkets render_info(line++, "ID", help.String(entity->para)); break; - case EntityType_CHECKPOINT: + case 8: // Checkpoints render_info(line++, "ID", help.String(entity->para)); render_info(line++, "Active", game.savepoint == entity->para ? "True" : "False"); break; - case EntityType_HORIZONTAL_GRAVITY_LINE: + case 9: // Horizontal gravity lines render_info(line++, "Horizontal"); break; - case EntityType_VERTICAL_GRAVITY_LINE: + case 10: // Vertical gravity lines render_info(line++, "Vertical"); break; - default: - break; } @@ -461,7 +459,7 @@ namespace level_debugger buffer, sizeof(buffer), text, "button:str", - loc::gettext("TAB") + "TAB" ); font::print(PR_BOR, 5, 14, buffer, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2)); diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 958bc8b2..51e3e71e 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -373,7 +373,7 @@ void gamelogic(void) { if (game.roomx == 111 && game.roomy == 107 && !map.custommode) { - if (obj.entities[i].type == EntityType_MOVING) + if (obj.entities[i].type == 1) { if (obj.entities[i].xp < 152) { @@ -391,7 +391,7 @@ void gamelogic(void) } } } - if (obj.entities[i].type == EntityType_DISAPPEARING_PLATFORM && obj.entities[i].state == 3) + if (obj.entities[i].type == 2 && obj.entities[i].state == 3) { //Ok! super magical exception for the room with the intention death for the shiny trinket //fix this when the maps are finalised @@ -405,7 +405,7 @@ void gamelogic(void) map.settile(18, 9, 59); } } - else if (obj.entities[i].type == EntityType_DISAPPEARING_PLATFORM && obj.entities[i].state == 2) + else if (obj.entities[i].type == 2 && obj.entities[i].state == 2) { //ok, unfortunate case where the disappearing platform hasn't fully disappeared. Accept a little //graphical uglyness to avoid breaking the room! @@ -421,7 +421,7 @@ void gamelogic(void) } if (!entitygone) obj.entities[i].state = 4; } - else if (obj.entities[i].type == EntityType_GRAVITRON_ENEMY && game.swnmode && game.deathseq<15) + else if (obj.entities[i].type == 23 && game.swnmode && game.deathseq<15) { //if playing SWN, get the enemies offscreen. obj.entities[i].xp += obj.entities[i].vx*5; @@ -461,8 +461,6 @@ void gamelogic(void) game.deathseq--; if (game.deathseq <= 0) { - game.invalidate_ndm_trophy(); - if (game.nodeathmode) { game.deathseq = 1; @@ -730,7 +728,7 @@ void gamelogic(void) bool square_onscreen = false; for (size_t i = 0; i < obj.entities.size(); i++) { - if (obj.entities[i].type == EntityType_GRAVITRON_ENEMY) + if (obj.entities[i].type == 23) { square_onscreen = true; break; @@ -837,7 +835,7 @@ void gamelogic(void) } } - if (obj.horplatforms) + if(obj.horplatforms) { for (int ie = obj.entities.size() - 1; ie >= 0; ie--) { @@ -861,10 +859,7 @@ void gamelogic(void) //is the player standing on a moving platform? int i = obj.getplayer(); float j = obj.entitycollideplatformfloor(i); - // To match 2.2, we need to give a bit of leeway in the lifeseq - // before we start pushing the player. - const bool horz_active = game.lifeseq < 8; - if (horz_active && INBOUNDS_VEC(i, obj.entities) && j > -1000) + if (INBOUNDS_VEC(i, obj.entities) && j > -1000) { obj.entities[i].newxp = obj.entities[i].xp + j; obj.entitymapcollision(i); @@ -872,7 +867,7 @@ void gamelogic(void) else { j = obj.entitycollideplatformroof(i); - if (horz_active && INBOUNDS_VEC(i, obj.entities) && j > -1000) + if (INBOUNDS_VEC(i, obj.entities) && j > -1000) { obj.entities[i].newxp = obj.entities[i].xp + j; obj.entitymapcollision(i); @@ -1036,11 +1031,9 @@ void gamelogic(void) size_t i; for (i = 0; i < obj.entities.size(); ++i) { - if (obj.entities[i].type == EntityType_WARP_LINE_LEFT - || obj.entities[i].type == EntityType_WARP_LINE_RIGHT - || obj.entities[i].type == EntityType_WARP_LINE_TOP - || obj.entities[i].type == EntityType_WARP_LINE_BOTTOM /* Don't warp warp lines */ - || obj.entities[i].size == 12) /* Don't warp gravitron squares */ + if ((obj.entities[i].type >= 51 + && obj.entities[i].type <= 54) /* Don't warp warp lines */ + || obj.entities[i].size == 12) /* Don't warp gravitron squares */ { continue; } @@ -1096,10 +1089,8 @@ void gamelogic(void) size_t i; for (i = 0; i < obj.entities.size(); ++i) { - if (obj.entities[i].type == EntityType_WARP_LINE_LEFT - || obj.entities[i].type == EntityType_WARP_LINE_RIGHT - || obj.entities[i].type == EntityType_WARP_LINE_TOP - || obj.entities[i].type == EntityType_WARP_LINE_BOTTOM) /* Don't warp warp lines */ + if (obj.entities[i].type >= 51 + && obj.entities[i].type <= 54) /* Don't warp warp lines */ { continue; } @@ -1130,11 +1121,9 @@ void gamelogic(void) size_t i; for (i = 0; i < obj.entities.size(); ++i) { - if ((obj.entities[i].type == EntityType_WARP_LINE_LEFT - || obj.entities[i].type == EntityType_WARP_LINE_RIGHT - || obj.entities[i].type == EntityType_WARP_LINE_TOP - || obj.entities[i].type == EntityType_WARP_LINE_BOTTOM) /* Don't warp warp lines */ - || obj.entities[i].rule == 0) /* Don't warp the player */ + if ((obj.entities[i].type >= 51 + && obj.entities[i].type <= 54) /* Don't warp warp lines */ + || obj.entities[i].rule == 0) /* Don't warp the player */ { continue; } diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index e60d6200..747ebc38 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -52,8 +52,9 @@ mapclass::mapclass(void) custommode=false; custommodeforreal=false; + custommmxoff=0; custommmyoff=0; custommmxsize=0; custommmysize=0; + customzoom=0; customshowmm=true; - revealmap = true; rcol = 0; @@ -87,9 +88,6 @@ mapclass::mapclass(void) roomtexton = false; nexttowercolour_set = false; - - currentregion = 0; - SDL_zeroa(region); } static char roomname_static[SCREEN_WIDTH_CHARS]; @@ -200,12 +198,6 @@ void mapclass::resetmap(void) SDL_memset(explored, 0, sizeof(explored)); } -void mapclass::fullmap(void) -{ - //mark the whole map as explored - SDL_memset(explored, 1, sizeof(explored)); -} - void mapclass::updateroomnames(void) { if (roomnameset) @@ -486,28 +478,28 @@ int mapclass::maptiletoenemycol(int t) switch(t) { case 0: - return EntityColour_ENEMY_CYAN; + return 11; break; case 1: - return EntityColour_ENEMY_RED; + return 6; break; case 2: - return EntityColour_ENEMY_PINK; + return 8; break; case 3: - return EntityColour_ENEMY_BLUE; + return 12; break; case 4: - return EntityColour_ENEMY_YELLOW; + return 9; break; case 5: - return EntityColour_ENEMY_GREEN; + return 7; break; case 6: - return EntityColour_ENEMY_GRAY; + return 18; break; } - return EntityColour_ENEMY_CYAN; + return 11; } void mapclass::changefinalcol(int t) @@ -519,7 +511,7 @@ void mapclass::changefinalcol(int t) //Next, entities for (size_t i = 0; i < obj.entities.size(); i++) { - if (obj.entities[i].type == EntityType_MOVING) + if (obj.entities[i].type == 1) //something with a movement behavior { if (obj.entities[i].animate == 10 || obj.entities[i].animate == 11) //treadmill { @@ -542,7 +534,7 @@ void mapclass::changefinalcol(int t) obj.entities[i].colour = maptiletoenemycol(temp); } } - else if (obj.entities[i].type == EntityType_DISAPPEARING_PLATFORM) + else if (obj.entities[i].type == 2) //disappearing platforms { obj.entities[i].tile = 915+(temp*40); } @@ -892,7 +884,7 @@ void mapclass::gotoroom(int rx, int ry) //Ok, let's save the position of all lines on the screen for (size_t i = 0; i < obj.entities.size(); i++) { - if (obj.entities[i].type == EntityType_HORIZONTAL_GRAVITY_LINE) + if (obj.entities[i].type == 9) { //It's a horizontal line if (obj.entities[i].xp <= 0 || (obj.entities[i].xp + obj.entities[i].w) >= 312) @@ -1030,7 +1022,7 @@ void mapclass::gotoroom(int rx, int ry) for (size_t i = 0; i < obj.entities.size(); i++) { - if (obj.entities[i].type == EntityType_HORIZONTAL_GRAVITY_LINE) + if (obj.entities[i].type == 9) { //It's a horizontal line if (obj.entities[i].xp <= 0 || obj.entities[i].xp + obj.entities[i].w >= 312) @@ -1312,15 +1304,12 @@ static void copy_short_to_int(int* dest, const short* src, const size_t size) void mapclass::loadlevel(int rx, int ry) { int t; - if (revealmap) + if (!finalmode) { - if (!finalmode) + setexplored(rx - 100, ry - 100, true); + if (rx == 109 && !custommode) { - setexplored(rx - 100, ry - 100, true); - if (rx == 109 && !custommode) - { - exploretower(); - } + exploretower(); } } @@ -1861,7 +1850,7 @@ void mapclass::loadlevel(int rx, int ry) { case 1: // Enemies obj.customenemy = room->enemytype; - obj.createentity(ex, ey, 56, ent.p1, 4 + room->enemyv, bx1, by1, bx2, by2); + obj.createentity(ex, ey, 56, ent.p1, 4, bx1, by1, bx2, by2); break; case 2: // Platforms and conveyors if (ent.p1 <= 4) @@ -2058,7 +2047,7 @@ void mapclass::loadlevel(int rx, int ry) for (size_t i = 0; i < obj.entities.size(); i++) { - if (obj.entities[i].type == EntityType_MOVING && obj.entities[i].behave >= 8 && obj.entities[i].behave < 10) + if (obj.entities[i].type == 1 && obj.entities[i].behave >= 8 && obj.entities[i].behave < 10) { //put a block underneath int temp = obj.entities[i].xp / 8.0f; @@ -2185,7 +2174,7 @@ void mapclass::loadlevel(int rx, int ry) { //A slight varation - she's upside down obj.createentity(249, 62, 18, 16, 0, 18); - int j = obj.getcrewman(EntityColour_CREW_BLUE); + int j = obj.getcrewman(BLUE); if (INBOUNDS_VEC(j, obj.entities)) { obj.entities[j].rule = 7; @@ -2206,16 +2195,16 @@ void mapclass::twoframedelayfix(void) // A bit kludge-y, but it's the least we can do without changing the frame ordering. if (GlitchrunnerMode_less_than_or_equal(Glitchrunner2_2) - || !custommode - || game.deathseq != -1) + || !custommode + || game.deathseq != -1) return; int block_idx = -1; // obj.checktrigger() sets block_idx int activetrigger = obj.checktrigger(&block_idx); if (activetrigger <= -1 - || !INBOUNDS_VEC(block_idx, obj.blocks) - || activetrigger < 300) + || !INBOUNDS_VEC(block_idx, obj.blocks) + || activetrigger < 300) { return; } @@ -2226,131 +2215,3 @@ void mapclass::twoframedelayfix(void) game.setstatedelay(0); script.load(game.newscript); } - -MapRenderData mapclass::get_render_data(void) -{ - MapRenderData data; - data.width = getwidth(); - data.height = getheight(); - - data.startx = 0; - data.starty = 0; - - // Region handling - if (region[currentregion].isvalid) - { - data.startx = region[currentregion].rx; - data.starty = region[currentregion].ry; - data.width = ((region[currentregion].rx2 - data.startx) + 1); - data.height = ((region[currentregion].ry2 - data.starty) + 1); - } - - data.zoom = 1; - - if (data.width <= 10 && data.height <= 10) - { - data.zoom = 2; - } - if (data.width <= 5 && data.height <= 5) - { - data.zoom = 4; - } - - data.xoff = 0; - data.yoff = 0; - - // Set minimap offsets - switch (data.zoom) - { - case 4: - data.xoff = 24 * (5 - data.width); - data.yoff = 18 * (5 - data.height); - break; - case 2: - data.xoff = 12 * (10 - data.width); - data.yoff = 9 * (10 - data.height); - break; - default: - data.xoff = 6 * (20 - data.width); - data.yoff = (int)(4.5 * (20 - data.height)); - break; - } - - data.pixelsx = 240 - (data.xoff * 2); - data.pixelsy = 180 - (data.yoff * 2); - - data.legendxoff = 40 + data.xoff; - data.legendyoff = 21 + data.yoff; - - // Magic numbers for centering legend tiles. - switch (data.zoom) - { - case 4: - data.legendxoff += 21; - data.legendyoff += 16; - break; - case 2: - data.legendxoff += 9; - data.legendyoff += 5; - break; - default: - data.legendxoff += 3; - data.legendyoff += 1; - break; - } - - return data; -} - -void mapclass::setregion(int id, int rx, int ry, int rx2, int ry2) -{ - if (INBOUNDS_ARR(id, region) && id > 0) - { - // swap the variables if they're entered in the wrong order - if (rx2 < rx) - { - int temp = rx; - rx = rx2; - rx2 = temp; - } - if (ry2 < ry) - { - int temp = ry; - ry = ry2; - ry2 = temp; - } - - region[id].isvalid = true; - region[id].rx = SDL_clamp(rx, 0, cl.mapwidth - 1); - region[id].ry = SDL_clamp(ry, 0, cl.mapheight - 1); - region[id].rx2 = SDL_clamp(rx2, 0, cl.mapwidth - 1); - region[id].ry2 = SDL_clamp(ry2, 0, cl.mapheight - 1); - - if (id == currentregion) - { - cl.generatecustomminimap(); - } - } -} - -void mapclass::removeregion(int id) -{ - if (INBOUNDS_ARR(id, region) && id > 0) - { - SDL_zero(region[id]); - - if (id == currentregion) - { - cl.generatecustomminimap(); - } - } -} - -void mapclass::changeregion(int id) -{ - if (INBOUNDS_ARR(id, region)) - { - currentregion = id; - cl.generatecustomminimap(); - } -} diff --git a/desktop_version/src/Map.h b/desktop_version/src/Map.h index b025916e..d809c2e7 100644 --- a/desktop_version/src/Map.h +++ b/desktop_version/src/Map.h @@ -12,21 +12,6 @@ #include "TowerBG.h" #include "WarpClass.h" -struct MapRenderData -{ - int zoom; - int xoff; - int yoff; - int legendxoff; - int legendyoff; - int startx; - int starty; - int width; - int height; - int pixelsx; - int pixelsy; -}; - struct Roomtext { int x, y; @@ -73,8 +58,6 @@ public: void resetmap(void); - void fullmap(void); - void updateroomnames(void); void initmapdata(void); @@ -142,8 +125,6 @@ public: bool isexplored(const int rx, const int ry); void setexplored(const int rx, const int ry, const bool status); - bool revealmap; - int background; int rcol; int tileset; @@ -178,6 +159,8 @@ public: //Variables for playing custom levels bool custommode; bool custommodeforreal; + int custommmxoff, custommmyoff, custommmxsize, custommmysize; + int customzoom; bool customshowmm; //final level colour cycling stuff @@ -211,25 +194,6 @@ public: //Map cursor int cursorstate, cursordelay; - - //Region system - struct Region - { - bool isvalid; - int rx; - int ry; - int rx2; - int ry2; - }; - struct Region region[401]; - void setregion(int id, int rx, int ry, int rx2, int ry2); - void removeregion(int id); - void changeregion(int id); - int currentregion; - int regionx, regiony; - int regionwidth, regionheight; - - MapRenderData get_render_data(void); }; #ifndef MAP_DEFINITION diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index 2e2ba84e..b725940c 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -504,9 +504,9 @@ end: } } - static void SetVolume(int controlVolume) + static void SetVolume(int musicVolume) { - float adj_vol = (float)controlVolume / VVV_MAX_VOLUME; + float adj_vol = (float) musicVolume / VVV_MAX_VOLUME; if (!IsHalted()) { FAudioVoice_SetVolume(musicVoice, adj_vol, FAUDIO_COMMIT_NOW); @@ -715,7 +715,7 @@ musicclass::musicclass(void) safeToProcessMusic= false; m_doFadeInVol = false; m_doFadeOutVol = false; - controlVolume = 0; + musicVolume = 0; user_music_volume = USER_VOLUME_MAX; user_sound_volume = USER_VOLUME_MAX; @@ -909,16 +909,6 @@ void musicclass::destroy(void) VVV_freefunc(FAudio_Release, faudioctx); } -void musicclass::set_music_volume(int volume) -{ - MusicTrack::SetVolume(volume * user_music_volume / USER_VOLUME_MAX); -} - -void musicclass::set_sound_volume(int volume) -{ - SoundTrack::SetVolume(volume * user_sound_volume / USER_VOLUME_MAX); -} - void musicclass::play(int t) { if (mmmmmm && usingmmmmmm) @@ -971,8 +961,8 @@ void musicclass::play(int t) { m_doFadeInVol = false; m_doFadeOutVol = false; - controlVolume = VVV_MAX_VOLUME; - set_music_volume(controlVolume); + musicVolume = VVV_MAX_VOLUME; + MusicTrack::SetVolume(musicVolume); } } else @@ -1050,7 +1040,7 @@ void musicclass::haltdasmusik(const bool from_fade) void musicclass::silencedasmusik(void) { - controlVolume = 0; + musicVolume = 0; m_doFadeInVol = false; m_doFadeOutVol = false; } @@ -1107,10 +1097,10 @@ void musicclass::fadeMusicVolumeIn(int ms) m_doFadeOutVol = false; /* Ensure it starts at 0 */ - controlVolume = 0; + musicVolume = 0; /* Fix 1-frame glitch */ - set_music_volume(0); + MusicTrack::SetVolume(0); fade.step_ms = 0; fade.duration_ms = ms; @@ -1130,8 +1120,8 @@ void musicclass::fadeMusicVolumeOut(const int fadeout_ms) fade.step_ms = 0; /* Duration is proportional to current volume. */ - fade.duration_ms = fadeout_ms * controlVolume / VVV_MAX_VOLUME; - fade.start_volume = controlVolume; + fade.duration_ms = fadeout_ms * musicVolume / VVV_MAX_VOLUME; + fade.start_volume = musicVolume; fade.end_volume = 0; } @@ -1143,7 +1133,7 @@ void musicclass::fadeout(const bool quick_fade_ /*= true*/) void musicclass::processmusicfadein(void) { - enum FadeCode fade_code = processmusicfade(&fade, &controlVolume); + enum FadeCode fade_code = processmusicfade(&fade, &musicVolume); if (fade_code == Fade_finished) { m_doFadeInVol = false; @@ -1152,10 +1142,10 @@ void musicclass::processmusicfadein(void) void musicclass::processmusicfadeout(void) { - enum FadeCode fade_code = processmusicfade(&fade, &controlVolume); + enum FadeCode fade_code = processmusicfade(&fade, &musicVolume); if (fade_code == Fade_finished) { - controlVolume = 0; + musicVolume = 0; m_doFadeOutVol = false; haltdasmusik(true); } @@ -1309,20 +1299,20 @@ void musicclass::updatemutestate(void) { if (game.muted) { - set_music_volume(0); - set_sound_volume(0); + MusicTrack::SetVolume(0); + SoundTrack::SetVolume(0); } else { - set_sound_volume(VVV_MAX_VOLUME); + SoundTrack::SetVolume(VVV_MAX_VOLUME * user_sound_volume / USER_VOLUME_MAX); if (game.musicmuted) { - set_music_volume(0); + MusicTrack::SetVolume(0); } else { - set_music_volume(controlVolume); + MusicTrack::SetVolume(musicVolume * user_music_volume / USER_VOLUME_MAX); } } } diff --git a/desktop_version/src/Music.h b/desktop_version/src/Music.h index 5e994977..4085fb0b 100644 --- a/desktop_version/src/Music.h +++ b/desktop_version/src/Music.h @@ -70,9 +70,6 @@ public: void init(void); void destroy(void); - void set_music_volume(int volume); - void set_sound_volume(int volume); - void play(int t); void resume(void); void resumefade(const int fadein_ms); @@ -108,7 +105,7 @@ public: bool m_doFadeInVol; bool m_doFadeOutVol; - int controlVolume; + int musicVolume; /* 0..USER_VOLUME_MAX */ int user_music_volume; diff --git a/desktop_version/src/Otherlevel.cpp b/desktop_version/src/Otherlevel.cpp index c3528cce..74c7a514 100644 --- a/desktop_version/src/Otherlevel.cpp +++ b/desktop_version/src/Otherlevel.cpp @@ -1,7 +1,6 @@ #include "Otherlevel.h" #include "Game.h" -#include "Graphics.h" #include "Entity.h" #include "MakeAndPlay.h" #include "UtilityClass.h" @@ -8905,7 +8904,7 @@ const short* otherlevelclass::loadlevel(int rx, int ry) //violet obj.createentity(83, 126, 18, 20, 0, 18); - int crewman = obj.getcrewman(EntityColour_CREW_PURPLE); + int crewman = obj.getcrewman(PURPLE); if (INBOUNDS_VEC(crewman, obj.entities)) { obj.entities[crewman].rule = 7; diff --git a/desktop_version/src/ReleaseVersion.h b/desktop_version/src/ReleaseVersion.h index 288946dd..4200e2b7 100644 --- a/desktop_version/src/ReleaseVersion.h +++ b/desktop_version/src/ReleaseVersion.h @@ -1,6 +1,6 @@ #ifndef RELEASEVERSION_H #define RELEASEVERSION_H -#define RELEASE_VERSION "v2.5" +#define RELEASE_VERSION "v2.4.1" #endif /* RELEASEVERSION_H */ diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 771927bf..82132350 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -32,6 +32,15 @@ static int tr; static int tg; static int tb; +struct MapRenderData +{ + int zoom; + int xoff; + int yoff; + int legendxoff; + int legendyoff; +}; + static inline void drawslowdowntext(const int y) { switch (game.slowdown) @@ -105,7 +114,7 @@ static void volumesliderrender(void) } char slider[40 + 1]; - slider_get(slider, sizeof(slider), volume_max_position * volume / USER_VOLUME_MAX, volume_max_position + 1, 240); + slider_get(slider, sizeof(slider), volume_max_position*volume/USER_VOLUME_MAX, volume_max_position+1, 240); char buffer[SCREEN_WIDTH_CHARS + 1]; @@ -691,6 +700,9 @@ static void menurender(void) } case Menu::controller: { + font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Game Pad"), tr, tg, tb); + font::print_wrap(PR_CEN, -1, 55, loc::gettext("Change controller options."), tr, tg, tb); + int spacing = font::height(0); spacing = SDL_max(spacing, 10); @@ -698,15 +710,12 @@ static void menurender(void) { case 0: { - font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Stick Sensitivity"), tr, tg, tb); - font::print_wrap(PR_CEN, -1, 55, loc::gettext("Change the sensitivity of the analog stick."), tr, tg, tb); - - font::print(PR_RTL_XFLIP, 32, 95, loc::gettext("Low"), tr, tg, tb); - font::print(PR_CEN, -1, 95, loc::gettext("Medium"), tr, tg, tb); - font::print(PR_RIGHT | PR_RTL_XFLIP, 288, 95, loc::gettext("High"), tr, tg, tb); + font::print(PR_RTL_XFLIP, 32, 75, loc::gettext("Low"), tr, tg, tb); + font::print(PR_CEN, -1, 75, loc::gettext("Medium"), tr, tg, tb); + font::print(PR_RIGHT | PR_RTL_XFLIP, 288, 75, loc::gettext("High"), tr, tg, tb); char slider[SCREEN_WIDTH_CHARS + 1]; slider_get(slider, sizeof(slider), key.sensitivity, 5, 240); - font::print(PR_CEN, -1, 95+spacing, slider, tr, tg, tb); + font::print(PR_CEN, -1, 75+spacing, slider, tr, tg, tb); break; } case 1: @@ -715,117 +724,38 @@ static void menurender(void) case 4: case 5: { - const char* title = ""; - switch (game.currentmenuoption) - { - case 1: title = loc::gettext("Bind Flip"); break; - case 2: title = loc::gettext("Bind Enter"); break; - case 3: title = loc::gettext("Bind Menu"); break; - case 4: title = loc::gettext("Bind Restart"); break; - case 5: title = loc::gettext("Bind Interact"); break; - } - font::print(PR_2X | PR_CEN, -1, 30, title, tr, tg, tb); + char buffer_a[SCREEN_WIDTH_CHARS + 1]; + char buffer_b[SCREEN_WIDTH_CHARS + 1]; - if (game.currentmenuoption == 5 && !game.separate_interact) - { - font::print_wrap( - PR_CEN, -1, 55, - loc::gettext("Interact is currently Enter!|See speedrunner options."), - tr, tg, tb - ); - } - else if (!game.gpmenu_confirming) - { - font::print_wrap( - PR_CEN | PR_BRIGHTNESS(255 - help.glow*2), -1, 55, - loc::gettext("Press a button...|(or press ↑↓)"), - tr, tg, tb - ); - } - else - { - char expl[SCREEN_WIDTH_CHARS*3 + 1]; - const char* expl_template; + SDL_snprintf(buffer_a, sizeof(buffer_a), "%s%s", + loc::gettext("Flip is bound to: "), + BUTTONGLYPHS_get_all_gamepad_buttons(buffer_b, sizeof(buffer_b), ActionSet_InGame, Action_InGame_ACTION) + ); + font::print(PR_CEN, -1, 75, buffer_a, tr, tg, tb); - if (game.gpmenu_showremove) - { - expl_template = loc::gettext("Remove {button}?|Press again to confirm"); - } - else - { - expl_template = loc::gettext("Add {button}?|Press again to confirm"); - } + SDL_snprintf(buffer_a, sizeof(buffer_a), "%s%s", + loc::gettext("Enter is bound to: "), + BUTTONGLYPHS_get_all_gamepad_buttons(buffer_b, sizeof(buffer_b), ActionSet_InGame, Action_InGame_Map) + ); + font::print(PR_CEN, -1, 75+spacing, buffer_a, tr, tg, tb); - vformat_buf( - expl, sizeof(expl), - expl_template, - "button:str", - BUTTONGLYPHS_sdlbutton_to_glyph(game.gpmenu_lastbutton) - ); + SDL_snprintf(buffer_a, sizeof(buffer_a), "%s%s", + loc::gettext("Menu is bound to: "), + BUTTONGLYPHS_get_all_gamepad_buttons(buffer_b, sizeof(buffer_b), ActionSet_InGame, Action_InGame_Esc) + ); + font::print(PR_CEN, -1, 75+spacing*2, buffer_a, tr, tg, tb); - font::print_wrap(PR_CEN, -1, 55, expl, tr, tg, tb); - } - - for (int bind = 1; bind <= 5; bind++) - { - char buffer_a[SCREEN_WIDTH_CHARS + 1]; - char buffer_b[SCREEN_WIDTH_CHARS + 1]; - - const char* lbl; - ActionSet actionset; - int action; - - switch (bind) - { - case 1: - lbl = loc::gettext("Flip is bound to: "); - actionset = ActionSet_InGame; - action = Action_InGame_ACTION; - break; - case 2: - lbl = loc::gettext("Enter is bound to: "); - actionset = ActionSet_InGame; - action = Action_InGame_Map; - break; - case 3: - lbl = loc::gettext("Menu is bound to: "); - actionset = ActionSet_InGame; - action = Action_InGame_Esc; - break; - case 4: - lbl = loc::gettext("Restart is bound to: "); - actionset = ActionSet_InGame; - action = Action_InGame_Restart; - break; - default: - lbl = loc::gettext("Interact is bound to: "); - actionset = ActionSet_InGame; - action = Action_InGame_Interact; - } - - SDL_snprintf( - buffer_a, sizeof(buffer_a), "%s%s", lbl, - BUTTONGLYPHS_get_all_gamepad_buttons(buffer_b, sizeof(buffer_b), actionset, action) - ); - - int brightness = 255; - if (bind == 5 && !game.separate_interact) - { - brightness = 128; - } - else if (game.gpmenu_confirming && game.currentmenuoption == bind) - { - brightness = 255 - help.glow*2; - } - - font::print( - PR_CEN | PR_BRIGHTNESS(brightness), - -1, 85 + (spacing * (bind-1)), - buffer_a, - tr, tg, tb - ); - } + SDL_snprintf(buffer_a, sizeof(buffer_a), "%s%s", + loc::gettext("Restart is bound to: "), + BUTTONGLYPHS_get_all_gamepad_buttons(buffer_b, sizeof(buffer_b), ActionSet_InGame, Action_InGame_Restart) + ); + font::print(PR_CEN, -1, 75+spacing*3, buffer_a, tr, tg, tb); + SDL_snprintf(buffer_a, sizeof(buffer_a), "%s%s", + loc::gettext("Interact is bound to: "), + BUTTONGLYPHS_get_all_gamepad_buttons(buffer_b, sizeof(buffer_b), ActionSet_InGame, Action_InGame_Interact) + ); + font::print(PR_CEN | PR_BRIGHTNESS(game.separate_interact ? 255 : 128), -1, 75+spacing*4, buffer_a, tr, tg, tb); break; } } @@ -1209,7 +1139,6 @@ static void menurender(void) break; } case 2: - { font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Room Name BG"), tr, tg, tb); int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Lets you see through what is behind the name at the bottom of the screen."), tr, tg, tb); if (graphics.translucentroomname) @@ -1218,21 +1147,6 @@ static void menurender(void) font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Room name background is OPAQUE"), tr, tg, tb); break; } - case 3: - { - font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Checkpoint Saving"), tr, tg, tb); - int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Toggle if checkpoints should save the game."), tr, tg, tb); - if (!game.checkpoint_saving) - { - font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Checkpoint saving is OFF"), tr / 2, tg / 2, tb / 2); - } - else - { - font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Checkpoint saving is ON"), tr, tg, tb); - } - break; - } - } break; case Menu::accessibility: { @@ -2221,21 +2135,9 @@ void gamecompleterender(void) creditOffset += 140; if (graphics.onscreen(creditOffset + position)) { - const char* line1; - const char* line2; - if (graphics.flipmode) - { - line1 = loc::gettext("playing!"); - line2 = loc::gettext("Thanks for"); - } - else - { - line1 = loc::gettext("Thanks for"); - line2 = loc::gettext("playing!"); - } - font::print(PR_2X | PR_CEN | PR_CJK_HIGH, -1, creditOffset + position, line1, tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_CJK_HIGH, -1, creditOffset + position, loc::gettext("Thanks for"), tr, tg, tb); creditOffset += 20; - font::print(PR_2X | PR_CEN | PR_CJK_LOW, -1, creditOffset + position, line2, tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_CJK_LOW, -1, creditOffset + position, loc::gettext("playing!"), tr, tg, tb); } draw_skip_message(); @@ -2859,26 +2761,42 @@ static void draw_roomname_menu(void) #define FLIP_PR_CJK_LOW (graphics.flipmode ? PR_CJK_HIGH : PR_CJK_LOW) #define FLIP_PR_CJK_HIGH (graphics.flipmode ? PR_CJK_LOW : PR_CJK_HIGH) +static MapRenderData getmaprenderdata(void) +{ + MapRenderData data; + + data.zoom = map.custommode ? map.customzoom : 1; + data.xoff = map.custommode ? map.custommmxoff : 0; + data.yoff = map.custommode ? map.custommmyoff : 0; + data.legendxoff = 40 + data.xoff; + data.legendyoff = 21 + data.yoff; + + // Magic numbers for centering legend tiles. + switch (data.zoom) + { + case 4: + data.legendxoff += 20; + data.legendyoff += 14; + break; + case 2: + data.legendxoff += 8; + data.legendyoff += 5; + break; + default: + data.legendxoff += 2; + data.legendyoff += 1; + break; + } + + return data; +} + static void rendermap(void) { if (map.custommode && map.customshowmm) { - const MapRenderData data = map.get_render_data(); - - graphics.drawpixeltextbox(35 + data.xoff, 16 + data.yoff, data.pixelsx + 10, data.pixelsy + 10, 65, 185, 207); - - if (graphics.customminimaps[map.currentregion] != NULL) - { - graphics.draw_region_image(map.currentregion, 40 + data.xoff, 21 + data.yoff, data.pixelsx, data.pixelsy); - } - else if (map.currentregion == 0 && graphics.minimap_mounted) - { - graphics.drawpartimage(IMAGE_MINIMAP, 40 + data.xoff, 21 + data.yoff, data.pixelsx, data.pixelsy); - } - else - { - graphics.drawpartimage(IMAGE_CUSTOMMINIMAP, 40 + data.xoff, 21 + data.yoff, data.pixelsx, data.pixelsy); - } + graphics.drawpixeltextbox(35 + map.custommmxoff, 16 + map.custommmyoff, map.custommmxsize + 10, map.custommmysize + 10, 65, 185, 207); + graphics.drawpartimage(graphics.minimap_mounted ? IMAGE_MINIMAP : IMAGE_CUSTOMMINIMAP, 40 + map.custommmxoff, 21 + map.custommmyoff, map.custommmxsize, map.custommmysize); return; } @@ -2888,11 +2806,11 @@ static void rendermap(void) static void rendermapfog(void) { - const MapRenderData data = map.get_render_data(); + const MapRenderData data = getmaprenderdata(); - for (int j = data.starty; j < data.starty + data.height; j++) + for (int j = 0; j < map.getheight(); j++) { - for (int i = data.startx; i < data.startx + data.width; i++) + for (int i = 0; i < map.getwidth(); i++) { if (!map.isexplored(i, j)) { @@ -2901,7 +2819,7 @@ static void rendermapfog(void) { for (int y = 0; y < data.zoom; y++) { - graphics.drawimage(IMAGE_COVERED, data.xoff + 40 + (x * 12) + ((i - data.startx) * (12 * data.zoom)), data.yoff + 21 + (y * 9) + ((j - data.starty) * (9 * data.zoom)), false); + graphics.drawimage(IMAGE_COVERED, data.xoff + 40 + (x * 12) + (i * (12 * data.zoom)), data.yoff + 21 + (y * 9) + (j * (9 * data.zoom)), false); } } } @@ -2913,22 +2831,17 @@ static void rendermaplegend(void) { // Draw the map legend, aka teleports/targets/trinkets - const MapRenderData data = map.get_render_data(); + const MapRenderData data = getmaprenderdata(); for (size_t i = 0; i < map.teleporters.size(); i++) { - int x = map.teleporters[i].x - data.startx; - int y = map.teleporters[i].y - data.starty; - if (x >= 0 && y >= 0 && x < data.width && y < data.height) + if (map.showteleporters && map.isexplored(map.teleporters[i].x, map.teleporters[i].y)) { - if (map.showteleporters && map.isexplored(x + data.startx, y + data.starty)) - { - font::print(PR_FONT_8X8 | PR_FULLBOR, data.legendxoff + (x * 12 * data.zoom), data.legendyoff + (y * 9 * data.zoom), "💿", 171, 255, 252); - } - else if (map.showtargets && !map.isexplored(x + data.startx, y + data.starty)) - { - font::print(PR_FONT_8X8 | PR_FULLBOR, data.legendxoff + (x * 12 * data.zoom), data.legendyoff + (y * 9 * data.zoom), "❓", 64, 64, 64); - } + font::print(PR_FONT_8X8 | PR_FULLBOR, data.legendxoff + (map.teleporters[i].x * 12 * data.zoom), data.legendyoff + (map.teleporters[i].y * 9 * data.zoom), "💿", 171, 255, 252); + } + else if (map.showtargets && !map.isexplored(map.teleporters[i].x, map.teleporters[i].y)) + { + font::print(PR_FONT_8X8 | PR_FULLBOR, data.legendxoff + (map.teleporters[i].x * 12 * data.zoom), data.legendyoff + (map.teleporters[i].y * 9 * data.zoom), "❓", 64, 64, 64); } } @@ -2938,12 +2851,7 @@ static void rendermaplegend(void) { if (!obj.collect[i]) { - int x = map.shinytrinkets[i].x - data.startx; - int y = map.shinytrinkets[i].y - data.starty; - if (x >= 0 && y >= 0 && x < data.width && y < data.height) - { - font::print(PR_FONT_8X8 | PR_FULLBOR, data.legendxoff + (x * 12 * data.zoom), data.legendyoff + (y * 9 * data.zoom), "🪙", 254, 252, 58); - } + font::print(PR_FONT_8X8 | PR_FULLBOR, data.legendxoff + (map.shinytrinkets[i].x * 12 * data.zoom), data.legendyoff + (map.shinytrinkets[i].y * 9 * data.zoom), "🪙", 254, 252, 58); } } } @@ -2951,45 +2859,44 @@ static void rendermaplegend(void) static void rendermapcursor(const bool flashing) { - const MapRenderData data = map.get_render_data(); - int room_x = game.roomx - data.startx - 100; - int room_y = game.roomy - data.starty - 100; - int pixels_x = room_x * 12; - int pixels_y = room_y * 9; + const MapRenderData data = getmaprenderdata(); if (!map.custommode && game.roomx == 109) { // Draw the tower specially if (!flashing || game.noflashingmode) { - graphics.draw_rect(40 + pixels_x + 2, 21 + 2, 12 - 4, 180 - 4, 16, 245 - (help.glow * 2), 245 - (help.glow * 2)); + graphics.draw_rect(40 + ((game.roomx - 100) * 12) + 2, 21 + 2, 12 - 4, 180 - 4, 16, 245 - (help.glow * 2), 245 - (help.glow * 2)); } else if (map.cursorstate == 1) { if (int(map.cursordelay / 4) % 2 == 0) { - graphics.draw_rect(40 + pixels_x, 21, 12, 180, 255, 255, 255); - graphics.draw_rect(40 + pixels_x + 2, 21 + 2, 12 - 4, 180 - 4, 255, 255, 255); + graphics.draw_rect(40 + ((game.roomx - 100) * 12), 21, 12, 180, 255, 255, 255); + graphics.draw_rect(40 + ((game.roomx - 100) * 12) + 2, 21 + 2, 12 - 4, 180 - 4, 255, 255, 255); } } else if (map.cursorstate == 2 && (int(map.cursordelay / 15) % 2 == 0)) { - graphics.draw_rect(40 + pixels_x + 2, 21 + 2, 12 - 4, 180 - 4, 16, 245 - (help.glow), 245 - (help.glow)); + graphics.draw_rect(40 + ((game.roomx - 100) * 12) + 2, 21 + 2, 12 - 4, 180 - 4, 16, 245 - (help.glow), 245 - (help.glow)); } return; } - if (room_x >= 0 && room_y >= 0 && room_x < data.width && room_y < data.height) + if (!flashing || ((map.cursorstate == 2 && int(map.cursordelay / 15) % 2 == 0) || game.noflashingmode)) { - if (!flashing || ((map.cursorstate == 2 && int(map.cursordelay / 15) % 2 == 0) || game.noflashingmode)) - { - graphics.draw_rect(40 + (pixels_x * data.zoom) + 2 + data.xoff, 21 + (pixels_y * data.zoom) + 2 + data.yoff, (12 * data.zoom) - 4, (9 * data.zoom) - 4, 16, 245 - (help.glow), 245 - (help.glow)); - } - else if (map.cursorstate == 1 && int(map.cursordelay / 4) % 2 == 0) - { - graphics.draw_rect(40 + (pixels_x * data.zoom) + data.xoff, 21 + (pixels_y * data.zoom) + data.yoff, 12 * data.zoom, 9 * data.zoom, 255, 255, 255); - graphics.draw_rect(40 + (pixels_x * data.zoom) + 2 + data.xoff, 21 + (pixels_y * data.zoom) + 2 + data.yoff, (12 * data.zoom) - 4, (9 * data.zoom) - 4, 255, 255, 255); - } + int margin = (data.zoom == 4) ? 2 : 1; + graphics.draw_rect( + 40 + ((game.roomx - 100) * 12 * data.zoom) + margin + data.xoff, + 21 + ((game.roomy - 100) * 9 * data.zoom) + margin + data.yoff, + (12 * data.zoom) - (2 * margin), (9 * data.zoom) - (2 * margin), + 16, 245 - (help.glow), 245 - (help.glow) + ); + } + else if (map.cursorstate == 1 && int(map.cursordelay / 4) % 2 == 0) + { + graphics.draw_rect(40 + ((game.roomx - 100) * 12 * data.zoom) + data.xoff, 21 + ((game.roomy - 100) * 9 * data.zoom) + data.yoff, 12 * data.zoom, 9 * data.zoom, 255, 255, 255); + graphics.draw_rect(40 + ((game.roomx - 100) * 12 * data.zoom) + 2 + data.xoff, 21 + ((game.roomy - 100) * 9 * data.zoom) + 2 + data.yoff, (12 * data.zoom) - 4, (9 * data.zoom) - 4, 255, 255, 255); } } @@ -3181,30 +3088,26 @@ void maprender(void) font::print(title_flags | PR_2X | PR_CEN, -1, FLIP(45, 8), meta.title, 196, 196, 255 - help.glow); int sp = SDL_max(10, font::height(PR_FONT_LEVEL)); - int desc_pos = (cl.numcrewmates() > 0) ? 70 : 70 + (sp*2); graphics.print_level_creator(creator_flags, FLIP(70, 8), meta.creator, 196, 196, 255 - help.glow); - font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70 + sp, 8), meta.website, 196, 196, 255 - help.glow); - font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(desc_pos + sp*3, 8), meta.Desc1, 196, 196, 255 - help.glow); - font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(desc_pos + sp*4, 8), meta.Desc2, 196, 196, 255 - help.glow); + font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70+sp, 8), meta.website, 196, 196, 255 - help.glow); + font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70+sp*3, 8), meta.Desc1, 196, 196, 255 - help.glow); + font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70+sp*4, 8), meta.Desc2, 196, 196, 255 - help.glow); if (sp <= 10) { - font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(desc_pos + sp*5, 8), meta.Desc3, 196, 196, 255 - help.glow); + font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70+sp*5, 8), meta.Desc3, 196, 196, 255 - help.glow); } - if (cl.numcrewmates() > 0) - { - int remaining = cl.numcrewmates() - game.crewmates(); + int remaining = cl.numcrewmates() - game.crewmates(); - char buffer[SCREEN_WIDTH_CHARS + 1]; - loc::gettext_plural_fill( - buffer, sizeof(buffer), - "{n_crew|wordy} crewmates remain", - "{n_crew|wordy} crewmate remains", - "n_crew:int", - remaining - ); - font::print_wrap(PR_CEN, -1, FLIP(165, 8), buffer, 196, 196, 255 - help.glow); - } + char buffer[SCREEN_WIDTH_CHARS + 1]; + loc::gettext_plural_fill( + buffer, sizeof(buffer), + "{n_crew|wordy} crewmates remain", + "{n_crew|wordy} crewmate remains", + "n_crew:int", + remaining + ); + font::print_wrap(PR_CEN, -1, FLIP(165, 8), buffer, 196, 196, 255 - help.glow); } else { @@ -3277,29 +3180,21 @@ void maprender(void) } /* Stats. */ + font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(52, 8), loc::gettext("[Trinkets found]"), 196, 196, 255 - help.glow); + char buffer[SCREEN_WIDTH_CHARS + 1]; + vformat_buf( + buffer, sizeof(buffer), + loc::gettext("{n_trinkets|wordy} out of {max_trinkets|wordy}"), + "n_trinkets:int, max_trinkets:int", + game.trinkets(), max_trinkets + ); + font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(64, 8), buffer, 96, 96, 96); - // Always show trinkets if you're in the main game, otherwise only show them if any exist in the level - bool show_trinkets = map.custommode ? (cl.numtrinkets() > 0) : true; - int deaths_pos = show_trinkets ? 102 : 72; - int time_pos = show_trinkets ? 152 : 132; - if (show_trinkets) - { - font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(52, 8), loc::gettext("[Trinkets found]"), 196, 196, 255 - help.glow); - char buffer[SCREEN_WIDTH_CHARS + 1]; - vformat_buf( - buffer, sizeof(buffer), - loc::gettext("{n_trinkets|wordy} out of {max_trinkets|wordy}"), - "n_trinkets:int, max_trinkets:int", - game.trinkets(), max_trinkets - ); - font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(64, 8), buffer, 96, 96, 96); - } + font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(102, 8), loc::gettext("[Number of Deaths]"), 196, 196, 255 - help.glow); + font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(114, 8), help.String(game.deathcounts), 96, 96, 96); - font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(deaths_pos, 8), loc::gettext("[Number of Deaths]"), 196, 196, 255 - help.glow); - font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(deaths_pos + 12, 8), help.String(game.deathcounts), 96, 96, 96); - - font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(time_pos, 8), loc::gettext("[Time Taken]"), 196, 196, 255 - help.glow); - font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(time_pos + 12, 8), game.timestring(), 96, 96, 96); + font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(152, 8), loc::gettext("[Time Taken]"), 196, 196, 255 - help.glow); + font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(164, 8), game.timestring(), 96, 96, 96); break; } case 3: @@ -3568,7 +3463,7 @@ void teleporterrender(void) // Draw a box around the currently selected teleporter - const MapRenderData data = map.get_render_data(); + const MapRenderData data = getmaprenderdata(); if (game.useteleporter) { diff --git a/desktop_version/src/SDL_uikit_main.c b/desktop_version/src/SDL_uikit_main.c deleted file mode 100644 index 6ce34929..00000000 --- a/desktop_version/src/SDL_uikit_main.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - SDL_uikit_main.c, placed in the public domain by Sam Lantinga 3/18/2019 -*/ - -/* Include the SDL main definition header */ -#include "SDL_main.h" - -#if defined(__IPHONEOS__) || defined(__TVOS__) - -#ifndef SDL_MAIN_HANDLED -#ifdef main -#undef main -#endif - -int main(int argc, char *argv[]) -{ - return SDL_UIKitRunApp(argc, argv, SDL_main); -} -#endif /* !SDL_MAIN_HANDLED */ - -#endif /* __IPHONEOS__ || __TVOS__ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/desktop_version/src/Screen.cpp b/desktop_version/src/Screen.cpp index 1bc4c29a..cedf3115 100644 --- a/desktop_version/src/Screen.cpp +++ b/desktop_version/src/Screen.cpp @@ -383,7 +383,7 @@ bool Screen::isForcedFullscreen(void) * If you're working on a tenfoot-only build, add a def that always * returns true! */ -#if defined(__ANDROID__) || TARGET_OS_IPHONE +#ifdef __ANDROID__ return true; #else return SDL_GetHintBoolean("SteamTenfoot", SDL_FALSE); diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index 2d5487ce..d97fa9cf 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -53,7 +53,6 @@ scriptclass::scriptclass(void) textlarge = false; textbox_sprites.clear(); textbox_image = TEXTIMAGE_NONE; - textbox_absolutepos = false; } void scriptclass::add_default_colours(void) @@ -134,16 +133,16 @@ void scriptclass::tokenize( const std::string& t ) static int getcolorfromname(std::string name) { - if (name == "player") return EntityColour_CREW_CYAN; - else if (name == "cyan") return EntityColour_CREW_CYAN; - else if (name == "red") return EntityColour_CREW_RED; - else if (name == "green") return EntityColour_CREW_GREEN; - else if (name == "yellow") return EntityColour_CREW_YELLOW; - else if (name == "blue") return EntityColour_CREW_BLUE; - else if (name == "purple") return EntityColour_CREW_PURPLE; - else if (name == "customcyan") return EntityColour_CREW_CYAN; - else if (name == "gray") return EntityColour_CREW_GRAY; - else if (name == "teleporter") return EntityColour_TELEPORTER_FLASHING; + if (name == "player") return CYAN; + else if (name == "cyan") return CYAN; + else if (name == "red") return RED; + else if (name == "green") return GREEN; + else if (name == "yellow") return YELLOW; + else if (name == "blue") return BLUE; + else if (name == "purple") return PURPLE; + else if (name == "customcyan") return CYAN; + else if (name == "gray") return GRAY; + else if (name == "teleporter") return TELEPORTER; int color = help.Int(name.c_str(), -1); if (color < 0) return -1; // Not a number (or it's negative), so we give up @@ -158,6 +157,7 @@ static int getcrewmanfromname(std::string name) return obj.getcrewman(color); } + /* Also used in gamestate 1001. */ void foundtrinket_textbox1(textboxclass* THIS); void foundtrinket_textbox2(textboxclass* THIS); @@ -294,7 +294,7 @@ void scriptclass::run(void) { for (size_t edi = 0; edi < obj.entities.size(); edi++) { - if (obj.entities[edi].type == EntityType_HORIZONTAL_GRAVITY_LINE || obj.entities[edi].type == EntityType_VERTICAL_GRAVITY_LINE) + if (obj.entities[edi].type == 9 || obj.entities[edi].type == 10) { obj.disableentity(edi); } @@ -304,7 +304,7 @@ void scriptclass::run(void) { for (size_t edi = 0; edi < obj.entities.size(); edi++) { - if (obj.entities[edi].type == EntityType_WARP_TOKEN) + if (obj.entities[edi].type == 11) { obj.disableentity(edi); } @@ -331,7 +331,7 @@ void scriptclass::run(void) for (size_t edi = 0; edi < obj.entities.size(); edi++) { obj.disableblockat(obj.entities[edi].xp, obj.entities[edi].yp); - if (obj.entities[edi].type == EntityType_DISAPPEARING_PLATFORM && obj.entities[edi].rule == 3) + if (obj.entities[edi].type == 2 && obj.entities[edi].rule == 3) { obj.disableentity(edi); } @@ -371,23 +371,6 @@ void scriptclass::run(void) map.customshowmm=false; } } - else if (words[0] == "setregion") - { - map.setregion( - ss_toi(words[1]), - ss_toi(words[2]), - ss_toi(words[3]), - ss_toi(words[4]), - ss_toi(words[5])); - } - else if (words[0] == "removeregion") - { - map.removeregion(ss_toi(words[1])); - } - else if (words[0] == "changeregion") - { - map.changeregion(ss_toi(words[1])); - } if (words[0] == "delay") { //USAGE: delay(frames) @@ -566,15 +549,11 @@ void scriptclass::run(void) textcrewmateposition = TextboxCrewmatePosition(); textbox_sprites.clear(); textbox_image = TEXTIMAGE_NONE; - textbox_absolutepos = false; - textbox_force_outline = false; - textbox_outline = false; } else if (words[0] == "position") { //are we facing left or right? for some objects we don't care, default at 0. j = 0; - textbox_absolutepos = false; //the first word is the object to position relative to if (words[1] == "centerx") @@ -596,13 +575,6 @@ void scriptclass::run(void) textx = -500; texty = -500; } - else if (words[1] == "absolute") - { - words[2] = "donothing"; - j = -1; - textbox_absolutepos = true; - - } else // Well, are they asking for a crewmate...? { i = getcrewmanfromname(words[1]); @@ -637,37 +609,37 @@ void scriptclass::run(void) //the first word is the object to position relative to if (words[1] == "player") { - i = obj.getcustomcrewman(EntityColour_CREW_CYAN); + i = obj.getcustomcrewman(0); j = obj.entities[i].dir; } else if (words[1] == "cyan") { - i = obj.getcustomcrewman(EntityColour_CREW_CYAN); + i = obj.getcustomcrewman(0); j = obj.entities[i].dir; } else if (words[1] == "purple") { - i = obj.getcustomcrewman(EntityColour_CREW_PURPLE); + i = obj.getcustomcrewman(1); j = obj.entities[i].dir; } else if (words[1] == "yellow") { - i = obj.getcustomcrewman(EntityColour_CREW_YELLOW); + i = obj.getcustomcrewman(2); j = obj.entities[i].dir; } else if (words[1] == "red") { - i = obj.getcustomcrewman(EntityColour_CREW_RED); + i = obj.getcustomcrewman(3); j = obj.entities[i].dir; } else if (words[1] == "green") { - i = obj.getcustomcrewman(EntityColour_CREW_GREEN); + i = obj.getcustomcrewman(4); j = obj.entities[i].dir; } else if (words[1] == "blue") { - i = obj.getcustomcrewman(EntityColour_CREW_BLUE); + i = obj.getcustomcrewman(5); j = obj.entities[i].dir; } else if (words[1] == "centerx") @@ -709,7 +681,7 @@ void scriptclass::run(void) texty = 0; textcrewmateposition.x = obj.entities[i].xp; textcrewmateposition.override_x = true; - textcrewmateposition.y = obj.entities[i].yp; + textcrewmateposition.y = obj.entities[i].xp; textcrewmateposition.override_y = true; textcrewmateposition.dir = j; @@ -747,23 +719,6 @@ void scriptclass::run(void) textbox_image = TEXTIMAGE_NONE; } } - else if (words[0] == "textoutline") - { - if (words[1] == "default") - { - textbox_force_outline = false; - } - else if (words[1] == "on") - { - textbox_force_outline = true; - textbox_outline = true; - } - else if (words[1] == "off") - { - textbox_force_outline = true; - textbox_outline = false; - } - } else if (words[0] == "flipme") { textflipme = !textflipme; @@ -802,28 +757,16 @@ void scriptclass::run(void) graphics.setimage(textbox_image); - if (textbox_absolutepos) + if (textx == -500 || textx == -1) { - graphics.textboxabsolutepos(textx, texty); - } - else - { - if (textx == -500 || textx == -1) - { - graphics.textboxcenterx(); - textcrewmateposition.override_x = false; - } - - if (texty == -500) - { - graphics.textboxcentery(); - textcrewmateposition.override_y = false; - } + graphics.textboxcenterx(); + textcrewmateposition.override_x = false; } - if (textbox_force_outline) + if (texty == -500) { - graphics.textboxoutline(textbox_outline); + graphics.textboxcentery(); + textcrewmateposition.override_y = false; } TextboxOriginalContext context = TextboxOriginalContext(); @@ -909,7 +852,7 @@ void scriptclass::run(void) obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[i].size = 13; - obj.entities[i].colour = EntityColour_GRAVITRON_INDICATOR; + obj.entities[i].colour = 23; obj.entities[i].cx = 36;// 6; obj.entities[i].cy = 12+80;// 2; obj.entities[i].h = 126-80;// 21; @@ -924,7 +867,7 @@ void scriptclass::run(void) obj.entities[i].xp = 100; obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].size = 0; - obj.entities[i].colour = EntityColour_CREW_CYAN; + obj.entities[i].colour = 0; obj.entities[i].cx = 6; obj.entities[i].cy = 2; obj.entities[i].h = 21; @@ -1021,47 +964,47 @@ void scriptclass::run(void) { if (words[1] == "player") { - i=obj.getcustomcrewman(EntityColour_CREW_CYAN); + i=obj.getcustomcrewman(0); obj.customcrewmoods[0]=ss_toi(words[2]); } else if (words[1] == "cyan") { - i=obj.getcustomcrewman(EntityColour_CREW_CYAN); + i=obj.getcustomcrewman(0); obj.customcrewmoods[0]=ss_toi(words[2]); } else if (words[1] == "customcyan") { - i=obj.getcustomcrewman(EntityColour_CREW_CYAN); + i=obj.getcustomcrewman(0); obj.customcrewmoods[0]=ss_toi(words[2]); } else if (words[1] == "red") { - i=obj.getcustomcrewman(EntityColour_CREW_RED); + i=obj.getcustomcrewman(3); obj.customcrewmoods[3]=ss_toi(words[2]); } else if (words[1] == "green") { - i=obj.getcustomcrewman(EntityColour_CREW_GREEN); + i=obj.getcustomcrewman(4); obj.customcrewmoods[4]=ss_toi(words[2]); } else if (words[1] == "yellow") { - i=obj.getcustomcrewman(EntityColour_CREW_YELLOW); + i=obj.getcustomcrewman(2); obj.customcrewmoods[2]=ss_toi(words[2]); } else if (words[1] == "blue") { - i=obj.getcustomcrewman(EntityColour_CREW_BLUE); + i=obj.getcustomcrewman(5); obj.customcrewmoods[5]=ss_toi(words[2]); } else if (words[1] == "purple") { - i=obj.getcustomcrewman(EntityColour_CREW_PURPLE); + i=obj.getcustomcrewman(1); obj.customcrewmoods[1]=ss_toi(words[2]); } else if (words[1] == "pink") { - i=obj.getcustomcrewman(EntityColour_CREW_PURPLE); + i=obj.getcustomcrewman(1); obj.customcrewmoods[1]=ss_toi(words[2]); } @@ -1187,7 +1130,7 @@ void scriptclass::run(void) if (INBOUNDS_VEC(i, obj.entities)) { obj.entities[i].tile = 6; - obj.entities[i].colour = EntityColour_TELEPORTER_FLASHING; + obj.entities[i].colour = 102; } } else if (words[0] == "changecolour") @@ -1263,8 +1206,6 @@ void scriptclass::run(void) { game.savedir = obj.entities[i].dir; } - - game.checkpoint_save(); } else if (words[0] == "gamestate") { @@ -1387,28 +1328,6 @@ void scriptclass::run(void) map.setexplored(19, 7, false); map.setexplored(19, 8, false); } - else if (words[0] == "mapexplored") - { - if (words[1] == "none") - { - map.resetmap(); - } - else if (words[1] == "all") - { - map.fullmap(); - } - } - else if (words[0] == "mapreveal") - { - if (words[1] == "on") - { - map.revealmap = true; - } - else if (words[1] == "off") - { - map.revealmap = false; - } - } else if (words[0] == "showteleporters") { map.showteleporters = true; @@ -1494,7 +1413,7 @@ void scriptclass::run(void) { game.unlocknum(Unlock_SECRETLAB); game.insecretlab = true; - map.fullmap(); + SDL_memset(map.explored, true, sizeof(map.explored)); } else if (words[0] == "leavesecretlab") { @@ -1647,9 +1566,9 @@ void scriptclass::run(void) { for (j = 0; j < (int) obj.entities.size(); j++) { - if (obj.entities[j].type == EntityType_TERMINAL) + if (obj.entities[j].type == 13) { - obj.entities[j].colour = EntityColour_INACTIVE_ENTITY; + obj.entities[j].colour = 4; } } if (ss_toi(words[1]) == 1) @@ -1659,7 +1578,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 88 && obj.entities[j].yp==80) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1670,7 +1589,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 128 && obj.entities[j].yp==80) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1681,7 +1600,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 176 && obj.entities[j].yp==80) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1692,7 +1611,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 216 && obj.entities[j].yp==80) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1703,7 +1622,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 88 && obj.entities[j].yp==128) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1714,7 +1633,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 176 && obj.entities[j].yp==128) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1725,7 +1644,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 40 && obj.entities[j].yp==40) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1736,7 +1655,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 216 && obj.entities[j].yp==128) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1747,7 +1666,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 128 && obj.entities[j].yp==128) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1758,7 +1677,7 @@ void scriptclass::run(void) { if (obj.entities[j].xp == 264 && obj.entities[j].yp==40) { - obj.entities[j].colour = EntityColour_ACTIVE_ENTITY; + obj.entities[j].colour = 5; } } } @@ -1769,31 +1688,31 @@ void scriptclass::run(void) if (words[1] == "red") { i = 3; - crew_color = EntityColour_CREW_RED; + crew_color = RED; } else if (words[1] == "green") { i = 4; - crew_color = EntityColour_CREW_GREEN; + crew_color = GREEN; } else if (words[1] == "yellow") { i = 2; - crew_color = EntityColour_CREW_YELLOW; + crew_color = YELLOW; } else if (words[1] == "blue") { i = 5; - crew_color = EntityColour_CREW_BLUE; + crew_color = BLUE; } else if (words[1] == "purple") { i = 1; - crew_color = EntityColour_CREW_PURPLE; + crew_color = PURPLE; } int crewman = obj.getcrewman(crew_color); - if (INBOUNDS_VEC(crewman, obj.entities) && crew_color == EntityColour_CREW_GREEN) + if (INBOUNDS_VEC(crewman, obj.entities) && crew_color == GREEN) { obj.createblock(5, obj.entities[crewman].xp - 32, obj.entities[crewman].yp-20, 96, 60, i, "", (i == 35)); } @@ -1849,9 +1768,8 @@ void scriptclass::run(void) i = obj.getplayer(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = cl.player_colour; + obj.entities[i].colour = 0; } - game.savecolour = cl.player_colour; } else if (words[0] == "changeplayercolour") { @@ -1875,7 +1793,7 @@ void scriptclass::run(void) i = obj.getteleporter(); if (INBOUNDS_VEC(i, obj.entities)) { - obj.entities[i].colour = EntityColour_TELEPORTER_ACTIVE; + obj.entities[i].colour = 101; } } else if (words[0] == "foundtrinket") @@ -1990,9 +1908,9 @@ void scriptclass::run(void) else if (words[0] == "createlastrescued") { r = graphics.crewcolour(game.lastsaved); - if (r == EntityColour_CREW_CYAN || r == EntityColour_CREW_PURPLE) + if (r == 0 || r == PURPLE) { - r = EntityColour_CREW_GRAY; // Default to gray if invalid color. + r = GRAY; // Default to gray if invalid color. } obj.createentity(200, 153, 18, r, 0, 19, 30); @@ -2652,7 +2570,7 @@ void scriptclass::startgamemode(const enum StartMode mode) } } - /* State which needs to be reset before gameplay starts + /* Containers which need to be reset before gameplay starts * ex. before custom levels get loaded */ switch (mode) @@ -2662,8 +2580,6 @@ void scriptclass::startgamemode(const enum StartMode mode) default: textbox_colours.clear(); add_default_colours(); - cl.onewaycol_override = false; - cl.player_colour = 0; break; } @@ -2735,16 +2651,6 @@ void scriptclass::startgamemode(const enum StartMode mode) graphics.showcutscenebars = true; graphics.setbars(320); load("intro"); - - if (!game.nocompetitive()) - { - game.nodeatheligible = true; - vlog_debug("NDM trophy is eligible."); - } - else - { - game.invalidate_ndm_trophy(); - } } break; @@ -2806,7 +2712,7 @@ void scriptclass::startgamemode(const enum StartMode mode) { game.timetrialcountdown = 0; game.timetrialparlost = true; - map.fullmap(); + SDL_memset(map.explored, true, sizeof(map.explored)); } graphics.fademode = FADE_START_FADEIN; @@ -2816,9 +2722,9 @@ void scriptclass::startgamemode(const enum StartMode mode) game.startspecial(0); /* Unlock the entire map */ - map.fullmap(); - /* Give all 20 trinkets */ SDL_memset(obj.collect, true, sizeof(obj.collect[0]) * 20); + /* Give all 20 trinkets */ + SDL_memset(map.explored, true, sizeof(map.explored)); i = 400; /* previously a nested for-loop set this */ game.insecretlab = true; map.showteleporters = true; @@ -2912,7 +2818,6 @@ void scriptclass::startgamemode(const enum StartMode mode) map.custommode = true; map.custommodeforreal = false; map.customshowmm = true; - map.revealmap = true; if (cl.levmusic > 0) { @@ -2939,7 +2844,6 @@ void scriptclass::startgamemode(const enum StartMode mode) cl.findstartpoint(); map.customshowmm = true; - map.revealmap = true; music.fadeout(); game.customstart(); @@ -3184,7 +3088,6 @@ void scriptclass::hardreset(void) game.nodeathmode = false; game.nocutscenes = false; - game.nodeatheligible = false; for (i = 0; i < (int) SDL_arraysize(game.crewstats); i++) { @@ -3209,7 +3112,7 @@ void scriptclass::hardreset(void) game.savey = 0; game.savegc = 0; } - game.savecolour = cl.player_colour; + game.savecolour = 0; game.intimetrial = false; game.timetrialcountdown = 0; @@ -3312,14 +3215,11 @@ void scriptclass::hardreset(void) map.cameraseekframe = 0; map.resumedelay = 0; graphics.towerbg.scrolldir = 0; - map.customshowmm = true; - map.revealmap = true; + map.customshowmm=true; SDL_memset(map.roomdeaths, 0, sizeof(map.roomdeaths)); SDL_memset(map.roomdeathsfinal, 0, sizeof(map.roomdeathsfinal)); map.resetmap(); - map.currentregion = 0; - SDL_zeroa(map.region); //entityclass obj.nearelephant = false; obj.upsetmode = false; @@ -3647,7 +3547,7 @@ bool scriptclass::loadcustom(const std::string& t) }else if(words[0] == "reply"){ //For this version, terminal only if(squeakmode==0) add("squeak(player)"); - add("text(player,0,0,"+words[1]+")"); + add("text(cyan,0,0,"+words[1]+")"); int ti=help.Int(words[1].c_str()); int nti = ti>=0 ? ti : 1; diff --git a/desktop_version/src/Script.h b/desktop_version/src/Script.h index 07607def..aa71220d 100644 --- a/desktop_version/src/Script.h +++ b/desktop_version/src/Script.h @@ -122,9 +122,6 @@ public: int textboxtimer; std::vector textbox_sprites; TextboxImage textbox_image; - bool textbox_absolutepos; - bool textbox_force_outline; - bool textbox_outline; //Misc int i, j, k; diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 40285c8e..a95eb87c 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -29,8 +29,6 @@ textboxclass::textboxclass(int gap) large = false; - position_absolute = false; - should_centerx = false; should_centery = false; @@ -43,9 +41,6 @@ textboxclass::textboxclass(int gap) image = TEXTIMAGE_NONE; - force_outline = false; - outline = false; - crewmate_position = TextboxCrewmatePosition(); original = TextboxOriginalContext(); original.text_case = 1; @@ -83,21 +78,18 @@ void textboxclass::centery(void) void textboxclass::applyposition(void) { resize(); - if (!position_absolute) + reposition(); + if (should_centerx) { - reposition(); - if (should_centerx) - { - centerx(); - } - if (should_centery) - { - centery(); - } - if (translate == TEXTTRANSLATE_CUTSCENE) - { - adjust(); - } + centerx(); + } + if (should_centery) + { + centery(); + } + if (translate == TEXTTRANSLATE_CUTSCENE) + { + adjust(); } } diff --git a/desktop_version/src/Textbox.h b/desktop_version/src/Textbox.h index 1e09b1bf..97b12d61 100644 --- a/desktop_version/src/Textbox.h +++ b/desktop_version/src/Textbox.h @@ -125,8 +125,6 @@ public: bool large; - bool position_absolute; - bool should_centerx; bool should_centery; @@ -137,9 +135,6 @@ public: std::vector sprites; TextboxImage image; - bool force_outline; - bool outline; - TextboxCrewmatePosition crewmate_position; TextboxOriginalContext original; TextboxSpacing spacing; diff --git a/desktop_version/src/Vlogging.c b/desktop_version/src/Vlogging.c index 15c6a69a..2b00095c 100644 --- a/desktop_version/src/Vlogging.c +++ b/desktop_version/src/Vlogging.c @@ -3,9 +3,8 @@ #include #include -#if defined(__ANDROID__) || TARGET_OS_IPHONE +#ifdef __ANDROID__ // forward to SDL logging on Android, since stdout/stderr are /dev/null -// they exist on iOS, but just get forwarded to the system log anyway, so might as well provide proper metadata #define VLOG_USE_SDL 1 #endif @@ -221,12 +220,6 @@ void vlog_open_console(void) vlog_error("Could not redirect STDERR to console."); } - handle = freopen("CON", "r", stdin); - if (handle == NULL) - { - vlog_error("Could not redirect STDIN to console."); - } - check_color_support(); if (!SetConsoleOutputCP(CP_UTF8)) diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index 4b87dbff..1dc9f989 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -363,23 +363,6 @@ static void emscriptenloop(void) } #endif -static void keep_console_open(const bool open_console) -{ - if (!open_console) - { - return; - } - - printf("Press ENTER to quit."); - - int c; - do - { - c = getchar(); - } - while (c != '\n' && c != EOF); -} - int main(int argc, char *argv[]) { char* baseDir = NULL; @@ -387,11 +370,9 @@ int main(int argc, char *argv[]) char* langDir = NULL; char* fontsDir = NULL; bool seed_use_sdl_getticks = false; +#ifdef _WIN32 bool open_console = false; - bool print_version = false; - bool print_addresses = false; - int invalid_arg = 0; - int invalid_partial_arg = 0; +#endif vlog_init(); @@ -405,16 +386,41 @@ int main(int argc, char *argv[]) } \ else \ { \ - invalid_partial_arg = i; \ + vlog_error("%s option requires one argument.", argv[i]); \ + VVV_exit(1); \ } if (ARG("-version")) { - print_version = true; + /* Just print the version and exit. No vlogging. */ + puts( + "VVVVVV " RELEASE_VERSION +#ifdef MAKEANDPLAY + " [M&P]" +#endif + ); +#ifdef INTERIM_VERSION_EXISTS + puts(COMMIT_DATE); + puts(INTERIM_COMMIT); + puts(BRANCH_NAME); +#endif + VVV_exit(0); } else if (ARG("-addresses")) { - print_addresses = true; + printf("cl : %p\n", (void*) &cl); + printf("ed : %p\n", (void*) &ed); + printf("game : %p\n", (void*) &game); + printf("gameScreen : %p\n", (void*) &gameScreen); + printf("graphics : %p\n", (void*) &graphics); + printf("help : %p\n", (void*) &help); + printf("key : %p\n", (void*) &key); + printf("map : %p\n", (void*) &map); + printf("music : %p\n", (void*) &music); + printf("obj : %p\n", (void*) &obj); + printf("script : %p\n", (void*) &script); + + VVV_exit(0); } else if (ARG("-renderer")) { @@ -535,7 +541,8 @@ int main(int argc, char *argv[]) #undef ARG else { - invalid_arg = i; + vlog_error("Error: invalid option: %s", argv[i]); + VVV_exit(1); } } @@ -550,62 +557,11 @@ int main(int argc, char *argv[]) } #endif - if (invalid_arg > 0) - { - vlog_error("Error: invalid option: %s", argv[invalid_arg]); - keep_console_open(open_console); - VVV_exit(1); - } - else if (invalid_partial_arg > 0) - { - vlog_error("%s option requires one argument.", argv[invalid_partial_arg]); - keep_console_open(open_console); - VVV_exit(1); - } - - if (print_version) - { - /* Just print the version and exit. No vlogging. */ - puts( - "VVVVVV " RELEASE_VERSION -#ifdef MAKEANDPLAY - " [M&P]" -#endif - ); -#ifdef INTERIM_VERSION_EXISTS - puts(COMMIT_DATE); - puts(INTERIM_COMMIT); - puts(BRANCH_NAME); -#endif - keep_console_open(open_console); - VVV_exit(0); - } - else if (print_addresses) - { - printf("cl : %p\n", (void*) &cl); - printf("ed : %p\n", (void*) &ed); - printf("game : %p\n", (void*) &game); - printf("gameScreen : %p\n", (void*) &gameScreen); - printf("graphics : %p\n", (void*) &graphics); - printf("help : %p\n", (void*) &help); - printf("key : %p\n", (void*) &key); - printf("map : %p\n", (void*) &map); - printf("music : %p\n", (void*) &music); - printf("obj : %p\n", (void*) &obj); - printf("script : %p\n", (void*) &script); - - keep_console_open(open_console); - VVV_exit(0); - } - SDL_SetHintWithPriority(SDL_HINT_IME_SHOW_UI, "1", SDL_HINT_OVERRIDE); - SDL_SetHintWithPriority(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, "1", SDL_HINT_OVERRIDE); /* We already do the button swapping in ButtonGlyphs, disable SDL's swapping */ SDL_SetHintWithPriority(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0", SDL_HINT_OVERRIDE); - SDL_SetHintWithPriority(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight", SDL_HINT_OVERRIDE); - if(!FILESYSTEM_init(argv[0], baseDir, assetsPath, langDir, fontsDir)) { vlog_error("Unable to initialize filesystem!"); @@ -818,7 +774,6 @@ int main(int argc, char *argv[]) cl.ListOfMetaData.push_back(meta); } else { vlog_error("Level not found"); - keep_console_open(open_console); VVV_exit(1); } } @@ -869,10 +824,9 @@ int main(int argc, char *argv[]) f_time = SDL_GetTicks64(); const Uint64 f_timetaken = f_time - f_timePrev; - const int timestep = game.get_timestep(); - if (!game.over30mode && f_timetaken < (Uint64) timestep) + if (!game.over30mode && f_timetaken < 34) { - const volatile Uint64 f_delay = timestep - f_timetaken; + const volatile Uint64 f_delay = 34 - f_timetaken; SDL_Delay((Uint32) f_delay); f_time = SDL_GetTicks64(); } diff --git a/desktop_version/version.cmake b/desktop_version/version.cmake index 2b9d2646..79bf71af 100644 --- a/desktop_version/version.cmake +++ b/desktop_version/version.cmake @@ -1,42 +1,25 @@ # Expects INPUT_FILE and OUTPUT_FILE to be defined -# find_package sets GIT_FOUND and GIT_EXECUTABLE -find_package(Git) +# Get interim commit and date of commit +EXECUTE_PROCESS( + COMMAND "${GIT_EXECUTABLE}" log -1 --format=%h + OUTPUT_VARIABLE INTERIM_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE +) -if(GIT_FOUND) - # Get interim commit and date of commit - execute_process( - COMMAND "${GIT_EXECUTABLE}" log -1 --format=%h - OUTPUT_VARIABLE INTERIM_COMMIT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) +EXECUTE_PROCESS( + COMMAND "${GIT_EXECUTABLE}" log -1 --format=%cd --date=short + OUTPUT_VARIABLE COMMIT_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE +) - execute_process( - COMMAND "${GIT_EXECUTABLE}" log -1 --format=%cd --date=short - OUTPUT_VARIABLE COMMIT_DATE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) +EXECUTE_PROCESS( + COMMAND "${GIT_EXECUTABLE}" branch --show-current + OUTPUT_VARIABLE BRANCH_NAME + OUTPUT_STRIP_TRAILING_WHITESPACE +) - execute_process( - COMMAND "${GIT_EXECUTABLE}" branch --show-current - OUTPUT_VARIABLE BRANCH_NAME - OUTPUT_STRIP_TRAILING_WHITESPACE - ) -endif() - -# Defaults if we don't have git or its commands fail for any reason or give blanks -# For annoying CMake reasons, must use "${VAR}" syntax rather than VAR -if("${INTERIM_COMMIT}" STREQUAL "") - set(INTERIM_COMMIT "(commit?)") -endif() -if("${COMMIT_DATE}" STREQUAL "") - set(COMMIT_DATE "(date?)") -endif() -if("${BRANCH_NAME}" STREQUAL "") - set(BRANCH_NAME "(branch?)") -endif() - -message(STATUS "This is interim commit ${INTERIM_COMMIT} (committed ${COMMIT_DATE}) on branch ${BRANCH_NAME}") +MESSAGE(STATUS "This is interim commit ${INTERIM_COMMIT} (committed ${COMMIT_DATE}) on branch ${BRANCH_NAME}") # Take the template file and replace the macros with what we have -configure_file(${INPUT_FILE} ${OUTPUT_FILE}) +CONFIGURE_FILE(${INPUT_FILE} ${OUTPUT_FILE}) diff --git a/third_party/SheenBidi b/third_party/SheenBidi index 83f77108..e667eb3a 160000 --- a/third_party/SheenBidi +++ b/third_party/SheenBidi @@ -1 +1 @@ -Subproject commit 83f77108a2873600283f6da4b326a2dca7a3a7a6 +Subproject commit e667eb3a63ee704194f8d94834d8e12b18db5b21