Merge tag '2.3.1'

main
Nichole Mattera 2 years ago
commit 16dee2c1c7
  1. 3
      .github/pull_request_template.md
  2. 2
      License exceptions.md
  3. 368
      desktop_version/CMakeLists.txt
  4. 41
      desktop_version/CONTRIBUTORS.txt
  5. 15
      desktop_version/README.md
  6. 8
      desktop_version/fixupMac.sh
  7. BIN
      desktop_version/icon.ico
  8. 1
      desktop_version/icon.rc
  9. 107
      desktop_version/src/BinaryBlob.cpp
  10. 43
      desktop_version/src/BinaryBlob.h
  11. 13
      desktop_version/src/BlockV.cpp
  12. 8
      desktop_version/src/BlockV.h
  13. 46
      desktop_version/src/Credits.h
  14. 84
      desktop_version/src/DeferCallbacks.c
  15. 31
      desktop_version/src/DeferCallbacks.h
  16. 18
      desktop_version/src/Ent.cpp
  17. 11
      desktop_version/src/Ent.h
  18. 748
      desktop_version/src/Entity.cpp
  19. 64
      desktop_version/src/Entity.h
  20. 6
      desktop_version/src/Exit.h
  21. 930
      desktop_version/src/FileSystemUtils.cpp
  22. 44
      desktop_version/src/FileSystemUtils.h
  23. 6
      desktop_version/src/GOGNetwork.c
  24. 1651
      desktop_version/src/Game.cpp
  25. 144
      desktop_version/src/Game.h
  26. 69
      desktop_version/src/GlitchrunnerMode.c
  27. 35
      desktop_version/src/GlitchrunnerMode.h
  28. 957
      desktop_version/src/Graphics.cpp
  29. 126
      desktop_version/src/Graphics.h
  30. 11
      desktop_version/src/GraphicsResources.cpp
  31. 153
      desktop_version/src/GraphicsUtil.cpp
  32. 4
      desktop_version/src/GraphicsUtil.h
  33. 1128
      desktop_version/src/Input.cpp
  34. 12
      desktop_version/src/Input.h
  35. 182
      desktop_version/src/KeyPoll.cpp
  36. 21
      desktop_version/src/KeyPoll.h
  37. 452
      desktop_version/src/Logic.cpp
  38. 10
      desktop_version/src/Logic.h
  39. 2
      desktop_version/src/MakeAndPlay.h
  40. 315
      desktop_version/src/Map.cpp
  41. 34
      desktop_version/src/Map.h
  42. 2
      desktop_version/src/Maths.h
  43. 381
      desktop_version/src/Music.cpp
  44. 46
      desktop_version/src/Music.h
  45. 28
      desktop_version/src/Network.c
  46. 6
      desktop_version/src/Network.h
  47. 16
      desktop_version/src/Otherlevel.cpp
  48. 1
      desktop_version/src/Otherlevel.h
  49. 856
      desktop_version/src/Render.cpp
  50. 12
      desktop_version/src/Render.h
  51. 30
      desktop_version/src/RenderFixed.cpp
  52. 10
      desktop_version/src/RenderFixed.h
  53. 61
      desktop_version/src/Screen.cpp
  54. 17
      desktop_version/src/Screen.h
  55. 2
      desktop_version/src/ScreenSettings.h
  56. 574
      desktop_version/src/Script.cpp
  57. 19
      desktop_version/src/Script.h
  58. 9
      desktop_version/src/Scripts.cpp
  59. 23
      desktop_version/src/SoundSystem.cpp
  60. 2
      desktop_version/src/SoundSystem.h
  61. 18
      desktop_version/src/SteamNetwork.c
  62. 30
      desktop_version/src/Textbox.cpp
  63. 22
      desktop_version/src/Textbox.h
  64. 2
      desktop_version/src/ThirdPartyDeps.c
  65. 10
      desktop_version/src/Tower.cpp
  66. 10
      desktop_version/src/Tower.h
  67. 6
      desktop_version/src/Unused.h
  68. 232
      desktop_version/src/UtilityClass.cpp
  69. 81
      desktop_version/src/UtilityClass.h
  70. 62
      desktop_version/src/Xoshiro.c
  71. 21
      desktop_version/src/Xoshiro.h
  72. 1407
      desktop_version/src/editor.cpp
  73. 105
      desktop_version/src/editor.h
  74. 661
      desktop_version/src/main.cpp
  75. 8
      desktop_version/src/preloader.cpp
  76. 6
      desktop_version/src/preloader.h
  77. 2
      third_party/tinyxml2/tinyxml2.cpp

@ -29,8 +29,7 @@ Describe your patch here!
By submitting this pull request, I confirm that...
- [ ] My changes may be used in a future commercial release of VVVVVV (for
example, a 2.3 update on Steam for Windows/macOS/Linux)
- [ ] My changes may be used in a future commercial release of VVVVVV
- [ ] I will be credited in a `CONTRIBUTORS` file and the "GitHub Friends"
section of the credits for all of said releases, but will NOT be compensated
for these changes

@ -1,6 +1,6 @@
Exceptions granted to the VVVVVV source code license
-------
Last updated on January 12th, 2020.
Last updated on November 22nd, 2020.
VVVVVV's source code is made available under a [custom license](LICENSE.md), which states that you must not distribute any materials from the game (i.e. the game's assets) which are not included in this repo unless approved by us in writing. The following is a list of projects which have been given permission by Terry to distribute the assets with distributions of the game, and under what conditions.

@ -1,89 +1,81 @@
# CMake File for VVVVVV
# Written by Ethan "flibitijibibo" Lee
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
cmake_minimum_required(VERSION 2.8.12)
# CMake Options
OPTION(ENABLE_WARNINGS "Enable compilation warnings" ON)
OPTION(ENABLE_WERROR "Treat compilation warnings as errors" OFF)
option(ENABLE_WARNINGS "Enable compilation warnings" ON)
option(ENABLE_WERROR "Treat compilation warnings as errors" OFF)
SET(CUSTOM_LEVEL_SUPPORT ENABLED CACHE STRING "Optionally disable playing and/or editing of custom levels")
SET_PROPERTY(CACHE CUSTOM_LEVEL_SUPPORT PROPERTY STRINGS ENABLED NO_EDITOR DISABLED)
option(BUNDLE_DEPENDENCIES "Use bundled TinyXML-2, PhysicsFS, and UTF8-CPP (if disabled, TinyXML-2 and PhysicsFS will be dynamically linked, LodePNG and UTF8-CPP will still be statically linked)" ON)
SET(STEAM OFF CACHE BOOL "Use the Steam API")
SET(GOG OFF CACHE BOOL "Use the GOG API")
set(CUSTOM_LEVEL_SUPPORT ENABLED CACHE STRING "Optionally disable playing and/or editing of custom levels")
set_property(CACHE CUSTOM_LEVEL_SUPPORT PROPERTY STRINGS ENABLED NO_EDITOR DISABLED)
SET(OFFICIAL_BUILD OFF CACHE BOOL "Compile an official build of the game")
option(STEAM "Use the Steam API" OFF)
option(GOG "Use the GOG API" OFF)
SET(MAKEANDPLAY OFF CACHE BOOL "Compile a version of the game without the main campaign (provided for convenience; consider modifying MakeAndPlay.h instead")
option(OFFICIAL_BUILD "Compile an official build of the game" OFF)
IF(OFFICIAL_BUILD AND NOT MAKEANDPLAY)
SET(STEAM ON)
SET(GOG ON)
ENDIF()
option(MAKEANDPLAY "Compile a version of the game without the main campaign (provided for convenience; consider modifying MakeAndPlay.h instead" OFF)
IF(MAKEANDPLAY)
ADD_DEFINITIONS(-DMAKEANDPLAY)
ENDIF()
if(OFFICIAL_BUILD AND NOT MAKEANDPLAY)
set(STEAM ON)
set(GOG ON)
endif()
if(${CMAKE_VERSION} VERSION_LESS "3.1.3")
message(WARNING "Your CMake version is too old; set -std=c90 -std=c++98 yourself!")
else()
set(CMAKE_C_STANDARD 90)
set(CMAKE_C_EXTENSIONS OFF)
# Set standard to C++98/C++03
SET(CMAKE_CXX_STANDARD 98)
SET(CMAKE_CXX_EXTENSIONS OFF) # prevent mixing stdlib implementations (dangerous!)
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
# Architecture Flags
IF(APPLE)
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)
IF(IS_DIRECTORY ${OSX_10_9_SDK_PATH})
SET(CMAKE_OSX_SYSROOT ${OSX_10_9_SDK_PATH})
ELSE()
MESSAGE(WARNING "CMAKE_OSX_SYSROOT not set and macOS 10.9 SDK not found! Using default one.")
ENDIF()
ENDIF()
SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
LINK_DIRECTORIES(/usr/local/lib)
ADD_COMPILE_OPTIONS(-Werror=partial-availability)
ENDIF()
PROJECT(VVVVVV)
IF(APPLE)
MESSAGE(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
ENDIF()
# Compiler Flags
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_DEFAULT=0 -DPHYSFS_SUPPORTS_ZIP=1)
set(OSX_10_9_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)
if(NOT CMAKE_OSX_SYSROOT)
if(IS_DIRECTORY ${OSX_10_9_SDK_PATH})
set(CMAKE_OSX_SYSROOT ${OSX_10_9_SDK_PATH})
else()
message(WARNING "CMAKE_OSX_SYSROOT not set and macOS 10.9 SDK not found! Using default one.")
endif()
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
link_directories(/usr/local/lib)
add_compile_options(-Werror=partial-availability)
endif()
# RPATH
IF(NOT WIN32)
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")
ELSE()
SET(BIN_LIBROOT "lib")
SET(BIN_RPATH "\$ORIGIN/lib")
ENDIF()
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH ${BIN_RPATH})
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
ENDIF()
project(VVVVVV)
# Include Directories
INCLUDE_DIRECTORIES(
src
../third_party/tinyxml2
../third_party/physfs
../third_party/lodepng
../third_party/utfcpp/source
)
if(APPLE)
message(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
endif()
# RPATH
if(NOT WIN32)
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")
else()
set(BIN_LIBROOT "lib")
set(BIN_RPATH "\$ORIGIN/lib")
endif()
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH ${BIN_RPATH})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
endif()
# Source Lists
SET(VVV_SRC
set(VVV_SRC
src/BinaryBlob.cpp
src/BlockV.cpp
src/Ent.cpp
@ -116,25 +108,62 @@ SET(VVV_SRC
src/WarpClass.cpp
src/XMLUtils.cpp
src/main.cpp
src/DeferCallbacks.c
src/GlitchrunnerMode.c
src/Network.c
src/ThirdPartyDeps.c
src/Xoshiro.c
)
IF(NOT CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
LIST(APPEND VVV_SRC src/editor.cpp)
ENDIF()
IF(STEAM)
LIST(APPEND VVV_SRC src/SteamNetwork.c)
ADD_DEFINITIONS(-DSTEAM_NETWORK)
ENDIF()
IF(GOG)
LIST(APPEND VVV_SRC src/GOGNetwork.c)
ADD_DEFINITIONS(-DGOG_NETWORK)
ENDIF()
SET(XML2_SRC
if(NOT CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
list(APPEND VVV_SRC src/editor.cpp)
endif()
if(STEAM)
list(APPEND VVV_SRC src/SteamNetwork.c)
endif()
if(GOG)
list(APPEND VVV_SRC src/GOGNetwork.c)
endif()
# Executable information
if(WIN32)
add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc)
else()
add_executable(VVVVVV ${VVV_SRC})
endif()
# Include Directories
if(BUNDLE_DEPENDENCIES)
target_include_directories(
VVVVVV PRIVATE
src
../third_party/tinyxml2
../third_party/physfs
../third_party/lodepng
../third_party/utfcpp/source
)
else()
target_include_directories(
VVVVVV PRIVATE
src
../third_party/lodepng
)
endif()
if(MAKEANDPLAY)
target_compile_definitions(VVVVVV PRIVATE -DMAKEANDPLAY)
endif()
if(STEAM)
target_compile_definitions(VVVVVV PRIVATE -DSTEAM_NETWORK)
endif()
if(GOG)
target_compile_definitions(VVVVVV PRIVATE -DGOG_NETWORK)
endif()
set(XML2_SRC
../third_party/tinyxml2/tinyxml2.cpp
)
SET(PFS_SRC
set(PFS_SRC
../third_party/physfs/physfs.c
../third_party/physfs/physfs_archiver_dir.c
../third_party/physfs/physfs_archiver_unpacked.c
@ -146,32 +175,25 @@ SET(PFS_SRC
../third_party/physfs/physfs_platform_windows.c
../third_party/physfs/physfs_platform_haiku.cpp
)
IF(APPLE)
if(APPLE)
# Are you noticing a pattern with this Apple crap yet?
SET(PFS_SRC ${PFS_SRC} ../third_party/physfs/physfs_platform_apple.m)
ENDIF()
SET(PNG_SRC ../third_party/lodepng/lodepng.c)
# Executable information
IF(WIN32)
ADD_EXECUTABLE(VVVVVV WIN32 ${VVV_SRC})
ELSE()
ADD_EXECUTABLE(VVVVVV ${VVV_SRC})
ENDIF()
set(PFS_SRC ${PFS_SRC} ../third_party/physfs/physfs_platform_apple.m)
endif()
set(PNG_SRC ../third_party/lodepng/lodepng.c)
IF(NOT OFFICIAL_BUILD)
if(NOT OFFICIAL_BUILD)
# Add interim commit hash and its date to the build
# FIND_PACKAGE sets GIT_FOUND and GIT_EXECUTABLE
FIND_PACKAGE(Git)
# find_package sets GIT_FOUND and GIT_EXECUTABLE
find_package(Git)
IF(GIT_FOUND)
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/Version.h.in)
SET(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.out)
set(VERSION_INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in)
set(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.out)
ADD_CUSTOM_TARGET(
add_custom_target(
GenerateVersion ALL
# This BYPRODUCTS line is required for this to be ran every time
BYPRODUCTS ${VERSION_OUTPUT_FILE}
@ -184,100 +206,130 @@ IF(NOT OFFICIAL_BUILD)
-P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake
)
ADD_DEPENDENCIES(VVVVVV GenerateVersion)
add_dependencies(VVVVVV GenerateVersion)
# This lets Version.h know that Version.h.out exists
ADD_DEFINITIONS(-DVERSION_H_OUT_EXISTS)
ENDIF()
ENDIF()
add_definitions(-DVERSION_H_OUT_EXISTS)
endif()
endif()
# Build options
IF(ENABLE_WARNINGS)
if(ENABLE_WARNINGS)
# The weird syntax is due to CMake generator expressions.
# Saves quite a few lines and boilerplate at the price of readability.
TARGET_COMPILE_OPTIONS(VVVVVV PRIVATE
target_compile_options(VVVVVV PRIVATE
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
-Wall $<$<BOOL:${ENABLE_WERROR}>:-Werror>>
-Wall -Wpedantic $<$<BOOL:${ENABLE_WERROR}>:-Werror>>
$<$<CXX_COMPILER_ID:MSVC>:
/W4 $<$<BOOL:${ENABLE_WERROR}>:/WX>>)
ENDIF()
IF(CUSTOM_LEVEL_SUPPORT STREQUAL "NO_EDITOR")
ADD_DEFINITIONS(-DNO_EDITOR)
ELSEIF(CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
ADD_DEFINITIONS(-DNO_CUSTOM_LEVELS -DNO_EDITOR)
ENDIF()
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
SET(SUPPORTS_IMPLICIT_FALLTHROUGH 1)
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
IF(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
SET(SUPPORTS_IMPLICIT_FALLTHROUGH 1)
ELSE()
SET(SUPPORTS_IMPLICIT_FALLTHROUGH 0)
ENDIF()
ELSE()
SET(SUPPORTS_IMPLICIT_FALLTHROUGH 0)
ENDIF()
IF(SUPPORTS_IMPLICIT_FALLTHROUGH)
TARGET_COMPILE_OPTIONS(VVVVVV PRIVATE -Werror=implicit-fallthrough)
ENDIF()
IF(MSVC)
endif()
if(CUSTOM_LEVEL_SUPPORT STREQUAL "NO_EDITOR")
add_definitions(-DNO_EDITOR)
elseif(CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
add_definitions(-DNO_CUSTOM_LEVELS -DNO_EDITOR)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(SUPPORTS_IMPLICIT_FALLTHROUGH TRUE)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(SUPPORTS_IMPLICIT_FALLTHROUGH TRUE)
else()
set(SUPPORTS_IMPLICIT_FALLTHROUGH FALSE)
endif()
else()
set(SUPPORTS_IMPLICIT_FALLTHROUGH FALSE)
endif()
if(SUPPORTS_IMPLICIT_FALLTHROUGH)
target_compile_options(VVVVVV PRIVATE -Werror=implicit-fallthrough)
endif()
if(MSVC)
# Disable MSVC warnings about implicit conversion
TARGET_COMPILE_OPTIONS(VVVVVV PRIVATE /wd4244)
ENDIF()
target_compile_options(VVVVVV PRIVATE /wd4244)
endif()
SET_PROPERTY(TARGET VVVVVV PROPERTY CXX_STANDARD 98)
SET_PROPERTY(TARGET VVVVVV PROPERTY CXX_EXTENSIONS FALSE)
if(MSVC)
# Disable exceptions
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
# Disable RTTI
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
else()
# Disable exceptions
string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
# Disable RTTI
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
endif()
# Library information
ADD_LIBRARY(tinyxml2-static STATIC ${XML2_SRC})
ADD_LIBRARY(physfs-static STATIC ${PFS_SRC} ${PFSP_SRC})
ADD_LIBRARY(lodepng-static STATIC ${PNG_SRC})
# Unfortunately, it doesn't seem like distros package LodePNG
add_library(lodepng-static STATIC ${PNG_SRC})
TARGET_COMPILE_DEFINITIONS(lodepng-static PRIVATE
target_compile_definitions(lodepng-static PRIVATE
-DLODEPNG_NO_COMPILE_ALLOCATORS
-DLODEPNG_NO_COMPILE_DISK
-DLODEPNG_NO_COMPILE_ENCODER
)
# Static Dependencies
TARGET_LINK_LIBRARIES(VVVVVV physfs-static tinyxml2-static lodepng-static)
if(BUNDLE_DEPENDENCIES)
add_library(tinyxml2-static STATIC ${XML2_SRC})
add_library(physfs-static STATIC ${PFS_SRC})
target_compile_definitions(physfs-static PRIVATE
-DPHYSFS_SUPPORTS_DEFAULT=0 -DPHYSFS_SUPPORTS_ZIP=1
)
# PhysFS needs some extensions...
if(${CMAKE_VERSION} VERSION_GREATER "3.1.3"
OR ${CMAKE_VERSION} VERSION_EQUAL "3.1.3")
set_property(TARGET physfs-static PROPERTY C_EXTENSIONS ON)
endif()
target_link_libraries(VVVVVV physfs-static tinyxml2-static lodepng-static)
else()
find_package(utf8cpp CONFIG)
target_link_libraries(VVVVVV physfs tinyxml2 utf8cpp lodepng-static)
endif()
# SDL2 Dependency (Detection pulled from FAudio)
if (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES)
if(DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES)
message(STATUS "Using pre-defined SDL2 variables SDL2_INCLUDE_DIRS and SDL2_LIBRARIES")
target_include_directories(VVVVVV SYSTEM PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>")
target_include_directories(VVVVVV SYSTEM PRIVATE "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>")
target_link_libraries(VVVVVV ${SDL2_LIBRARIES})
else()
# Only try to autodetect if both SDL2 variables aren't explicitly set
find_package(SDL2 CONFIG)
if (TARGET SDL2::SDL2)
if(TARGET SDL2::SDL2)
message(STATUS "Using TARGET SDL2::SDL2")
target_link_libraries(VVVVVV SDL2::SDL2 SDL2_mixer)
elseif (TARGET SDL2)
elseif(TARGET SDL2)
message(STATUS "Using TARGET SDL2")
target_link_libraries(VVVVVV SDL2 SDL2_mixer)
else()
message(STATUS "No TARGET SDL2::SDL2, or SDL2, using variables")
find_path(SDL2_MIXER_INCLUDE_DIRS NAMES SDL_mixer.h PATH_SUFFIXES SDL2)
target_include_directories(VVVVVV SYSTEM PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>" ${SDL2_MIXER_INCLUDE_DIRS})
target_include_directories(VVVVVV SYSTEM PRIVATE "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>" ${SDL2_MIXER_INCLUDE_DIRS})
target_link_libraries(VVVVVV ${SDL2_LIBRARIES} SDL2_mixer)
endif()
endif()
# Yes, more Apple Crap
IF(APPLE)
FIND_LIBRARY(FOUNDATION NAMES Foundation)
FIND_LIBRARY(IOKIT NAMES IOKit)
TARGET_LINK_LIBRARIES(VVVVVV objc ${IOKIT} ${FOUNDATION})
ENDIF()
if(APPLE)
find_library(FOUNDATION NAMES Foundation)
find_library(IOKIT NAMES IOKit)
target_link_libraries(VVVVVV objc ${IOKIT} ${FOUNDATION})
endif()
# But hey, also some Haiku crap
IF(HAIKU)
FIND_LIBRARY(BE_LIBRARY be)
FIND_LIBRARY(ROOT_LIBRARY root)
TARGET_LINK_LIBRARIES(VVVVVV ${BE_LIBRARY} ${ROOT_LIBRARY})
ENDIF()
if(HAIKU)
find_library(BE_LIBRARY be)
find_library(ROOT_LIBRARY root)
target_link_libraries(VVVVVV ${BE_LIBRARY} ${ROOT_LIBRARY})
endif()

@ -1,31 +1,36 @@
Contributors
------------
(Ordered alphabetically by last name.)
(Ordered alphabetically by first name.)
* Matt "FuรŸmatte" Aaldenberg
* AlexApps99 (@AlexApps99)
* Allison Fleischer (AllisonFleischer)
* AllyTally (@AllyTally)
* Christoph Bรถhmwalder (@chrboe)
* Charlie Bruce (@charliebruce)
* Brian Callahan (@ibara)
* Dav999 (Dav999-v)
* Allison Fleischer (AllisonFleischer)
* Charlie Bruce (@charliebruce)
* Christoph Bรถhmwalder (@chrboe)
* Daniel Lee (@ddm999)
* Dav999 (@Dav999-v)
* Elijah Stone (@moon-chilled)
* Elliott Saltar (@eboyblue3)
* Emmanuel Vadot (@evadot)
* Fredrik Ljungdahl (@FredrIQ)
* Nichole Mattera (@NicholeMattera)
* Matt Penny (@mwpenny)
* Jules de Sartiges (@strikersh)
* Keith Stellyes (@keithstellyes)
* KyoZM (@lsaa)
* leo60228 (@leo60228)
* MAO3J1m0Op (@MAO3J1m0Op)
* Tynan Richards (@tzann)
* Elliott Saltar (@eboyblue3)
* Malte Grimm (@trelbutate)
* Marvin Scholz (@ePirat)
* Keith Stellyes (@keithstellyes)
* Elijah Stone
* Thomas Sรคnger (@HorayNarea)
* Info Teddy (@InfoTeddy)
* Matt Penny (@mwpenny)
* Misa Elizabeth Kai (@InfoTeddy)
* mothbeanie (@mothbeanie)
* Nichole Mattera (@NicholeMattera)
* Pierre-Alain TORET (@daftaupe)
* leo60228 (@leo60228)
* Emmanuel Vadot (@evadot)
* Reese Rivers (@ReeseTheRivers)
* Rรฉmi Verschelde (@akien-mga)
* viri (viri.me)
* Wouter (Xesxen)
* Thomas Sรคnger (@HorayNarea)
* Tynan Richards (@tzann)
* Wouter (@Xesxen)
* viri (viri.moe)
* Vittorio Romeo (@SuperV1234)

@ -6,7 +6,7 @@ VVVVVV's official desktop versions are built with the following environments:
- macOS: Xcode CLT, currently targeting 10.9 SDK
- GNU/Linux: CentOS 7
The engine depends solely on [SDL2](https://libsdl.org/) and
The engine depends solely on [SDL2](https://libsdl.org/) 2.0.14+ and
[SDL2_mixer](https://www.libsdl.org/projects/SDL_mixer/). All other dependencies
are statically linked into the engine. The development libraries for Windows can
be downloaded from their respective websites, Linux developers can find the dev
@ -22,13 +22,24 @@ To generate the projects on Windows:
# Put your SDL2/SDL2_mixer folders somewhere nice!
mkdir flibitBuild
cd flibitBuild
cmake -G "Visual Studio 10 2010" .. -DSDL2_INCLUDE_DIRS="C:\SDL2-2.0.10\include;C:\SDL2_mixer-2.0.4\include" -DSDL2_LIBRARIES="C:\SDL2-2.0.10\lib\x86\SDL2;C:\SDL2-2.0.10\lib\x86\SDL2main;C:\SDL2_mixer-2.0.4\lib\x86\SDL2_mixer"
cmake -A Win32 -G "Visual Studio 10 2010" .. -DSDL2_INCLUDE_DIRS="C:\SDL2-2.0.14\include;C:\SDL2_mixer-2.0.4\include" -DSDL2_LIBRARIES="C:\SDL2-2.0.14\lib\x86\SDL2;C:\SDL2-2.0.14\lib\x86\SDL2main;C:\SDL2_mixer-2.0.4\lib\x86\SDL2_mixer"
```
Note that on some systems, the `SDL2_LIBRARIES` list on Windows may need
SDL2/SDL2main/SDL2_mixer to have `.lib` at the end of them. The reason for this
inconsistency is unknown.
Also note that if you're using a Visual Studio later than 2010, you will need to
change the `-G` string accordingly; otherwise you will get a weird cryptic
error. Refer to the list below:
- VS 2012: `"Visual Studio 11 2012"`
- VS 2013: `"Visual Studio 12 2013"`
- VS 2015: `"Visual Studio 14 2015"`
- VS 2017: `"Visual Studio 15 2017"`
- VS 2019: `"Visual Studio 16 2019"`
- VS 2022: `"Visual Studio 17 2022"`
To generate everywhere else:
```
mkdir flibitBuild

@ -0,0 +1,8 @@
#!/bin/bash
# flibit has this solely for convenience when cleaning up Mac binaries.
install_name_tool -change /usr/local/lib/libSDL2-2.0.0.dylib @rpath/libSDL2-2.0.0.dylib VVVVVV
install_name_tool -change /usr/local/lib/libSDL2_mixer-2.0.0.dylib @rpath/libSDL2_mixer-2.0.0.dylib VVVVVV
strip -S VVVVVV
otool -L VVVVVV

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

@ -0,0 +1 @@
AAA ICON "icon.ico"

@ -1,17 +1,17 @@
#include "BinaryBlob.h"
#include <physfs.h> /* FIXME: Abstract to FileSystemUtils! */
#include <SDL.h>
#include <stdio.h>
#include <stdlib.h>
#include "Exit.h"
#include "FileSystemUtils.h"
#include "UtilityClass.h"
binaryBlob::binaryBlob()
binaryBlob::binaryBlob(void)
{
numberofHeaders = 0;
SDL_memset(m_headers, 0, sizeof(m_headers));
SDL_memset(m_memblocks, 0, sizeof(m_memblocks));
SDL_zeroa(m_headers);
SDL_zeroa(m_memblocks);
}
#ifdef VVV_COMPILEMUSIC
@ -28,6 +28,10 @@ void binaryBlob::AddFileToBinaryBlob(const char* _path)
fseek(file, 0, SEEK_SET);
memblock = (char*) SDL_malloc(size);
if (memblock == NULL)
{
VVV_exit(1);
}
fread(memblock, 1, size, file);
fclose(file);
@ -73,78 +77,17 @@ void binaryBlob::writeBinaryBlob(const char* _name)
bool binaryBlob::unPackBinary(const char* name)
{
PHYSFS_sint64 size;
PHYSFS_File *handle = PHYSFS_openRead(name);
if (handle == NULL)
{
printf("Unable to open file %s\n", name);
return false;
}
size = PHYSFS_fileLength(handle);
PHYSFS_readBytes(handle, &m_headers, sizeof(m_headers));
int offset = 0 + (sizeof(m_headers));
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
{
/* Name can be stupid, just needs to be terminated */
m_headers[i].name[47] = '\0';
if (m_headers[i].valid & ~0x1 || !m_headers[i].valid)
{
m_headers[i].valid = false;
continue; /* Must be EXACTLY 1 or 0 */
}
if (m_headers[i].size < 1)
{
m_headers[i].valid = false;
continue; /* Must be nonzero and positive */
}
if ((offset + m_headers[i].size) > size)
{
m_headers[i].valid = false;
continue; /* Bogus size value */
}
PHYSFS_seek(handle, offset);
m_memblocks[i] = (char*) SDL_malloc(m_headers[i].size);
if (m_memblocks[i] == NULL)
{
exit(1); /* Oh god we're out of memory, just bail */
}
PHYSFS_readBytes(handle, m_memblocks[i], m_headers[i].size);
offset += m_headers[i].size;
}
PHYSFS_close(handle);
printf("The complete reloaded file size: %lli\n", size);
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
{
if (m_headers[i].valid == false)
{
break;
}
printf("%s unpacked\n", m_headers[i].name);
}
return true;
return FILESYSTEM_loadBinaryBlob(this, name);
}
void binaryBlob::clear()
void binaryBlob::clear(void)
{
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
{
if (m_headers[i].valid)
{
SDL_free(m_memblocks[i]);
m_headers[i].valid = false;
}
SDL_free(m_memblocks[i]);
}
SDL_zeroa(m_memblocks);
SDL_zeroa(m_headers);
}
int binaryBlob::getIndex(const char* _name)
@ -179,18 +122,24 @@ char* binaryBlob::getAddress(int _index)
return m_memblocks[_index];
}
std::vector<int> binaryBlob::getExtra()
bool binaryBlob::nextExtra(size_t* start)
{
std::vector<int> result;
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
size_t* idx;
if (start == NULL)
{
return false;
}
for (idx = start; *idx < SDL_arraysize(m_headers); *idx += 1)
{
if (m_headers[i].valid
#define FOREACH_TRACK(track_name) && SDL_strcmp(m_headers[i].name, track_name) != 0
TRACK_NAMES
if (m_headers[*idx].valid
#define FOREACH_TRACK(_, track_name) && SDL_strcmp(m_headers[*idx].name, track_name) != 0
TRACK_NAMES(_)
#undef FOREACH_TRACK
) {
result.push_back(i);
return true;
}
}
return result;
return false;
}

@ -1,28 +1,28 @@
#ifndef BINARYBLOB_H
#define BINARYBLOB_H
#include <vector>
#include <stddef.h>
/* Laaaazyyyyyyy -flibit */
// #define VVV_COMPILEMUSIC
#define TRACK_NAMES \
FOREACH_TRACK("data/music/0levelcomplete.ogg") \
FOREACH_TRACK("data/music/1pushingonwards.ogg") \
FOREACH_TRACK("data/music/2positiveforce.ogg") \
FOREACH_TRACK("data/music/3potentialforanything.ogg") \
FOREACH_TRACK("data/music/4passionforexploring.ogg") \
FOREACH_TRACK("data/music/5intermission.ogg") \
FOREACH_TRACK("data/music/6presentingvvvvvv.ogg") \
FOREACH_TRACK("data/music/7gamecomplete.ogg") \
FOREACH_TRACK("data/music/8predestinedfate.ogg") \
FOREACH_TRACK("data/music/9positiveforcereversed.ogg") \
FOREACH_TRACK("data/music/10popularpotpourri.ogg") \
FOREACH_TRACK("data/music/11pipedream.ogg") \
FOREACH_TRACK("data/music/12pressurecooker.ogg") \
FOREACH_TRACK("data/music/13pacedenergy.ogg") \
FOREACH_TRACK("data/music/14piercingthesky.ogg") \
FOREACH_TRACK("data/music/predestinedfatefinallevel.ogg")
#define TRACK_NAMES(blob) \
FOREACH_TRACK(blob, "data/music/0levelcomplete.ogg") \
FOREACH_TRACK(blob, "data/music/1pushingonwards.ogg") \
FOREACH_TRACK(blob, "data/music/2positiveforce.ogg") \
FOREACH_TRACK(blob, "data/music/3potentialforanything.ogg") \
FOREACH_TRACK(blob, "data/music/4passionforexploring.ogg") \
FOREACH_TRACK(blob, "data/music/5intermission.ogg") \
FOREACH_TRACK(blob, "data/music/6presentingvvvvvv.ogg") \
FOREACH_TRACK(blob, "data/music/7gamecomplete.ogg") \
FOREACH_TRACK(blob, "data/music/8predestinedfate.ogg") \
FOREACH_TRACK(blob, "data/music/9positiveforcereversed.ogg") \
FOREACH_TRACK(blob, "data/music/10popularpotpourri.ogg") \
FOREACH_TRACK(blob, "data/music/11pipedream.ogg") \
FOREACH_TRACK(blob, "data/music/12pressurecooker.ogg") \
FOREACH_TRACK(blob, "data/music/13pacedenergy.ogg") \
FOREACH_TRACK(blob, "data/music/14piercingthesky.ogg") \
FOREACH_TRACK(blob, "data/music/predestinedfatefinallevel.ogg")
struct resourceheader
{
@ -35,7 +35,7 @@ struct resourceheader
class binaryBlob
{
public:
binaryBlob();
binaryBlob(void);
#ifdef VVV_COMPILEMUSIC
void AddFileToBinaryBlob(const char* _path);
@ -49,15 +49,14 @@ public:
int getSize(int _index);
std::vector<int> getExtra();
bool nextExtra(size_t* start);
char* getAddress(int _index);
void clear();
void clear(void);
static const int max_headers = 128;
private:
int numberofHeaders;
resourceheader m_headers[max_headers];
char* m_memblocks[max_headers];

@ -1,6 +1,11 @@
#include "BlockV.h"
blockclass::blockclass()
blockclass::blockclass(void)
{
clear();
}
void blockclass::clear(void)
{
type = 0;
trigger = 0;
@ -18,8 +23,10 @@ blockclass::blockclass()
g = 0;
b = 0;
x = 0.0f;
y = 0.0f;
/* std::strings get initialized automatically, but this is */
/* in case this function gets called again after construction */
script.clear();
prompt.clear();
}
void blockclass::rectset(const int xi, const int yi, const int wi, const int hi)

@ -7,7 +7,8 @@
class blockclass
{
public:
blockclass();
blockclass(void);
void clear(void);
void rectset(const int xi, const int yi, const int wi, const int hi);
@ -20,11 +21,6 @@ public:
int xp, yp, wp, hp;
std::string script, prompt;
int r, g, b;
//These would come from the sprite in the flash
float x;
float y;
};
#endif /* BLOCKV_H */

@ -82,40 +82,48 @@ static const char* patrons[] = {
"Timothy Bragan",
};
/* CONTRIBUTORS.txt, again listed alphabetically (according to `sort`) by last name */
/* CONTRIBUTORS.txt, again listed alphabetically (according to `sort`) by first name */
static const char* githubfriends[] = {
"Matt \"Fussmatte\" Aaldenberg", // TODO: Change to "FuรŸmatte" if/when UTF-8 support is added
"Misa \"Info Teddy\" Kai",
"",
"and",
"",
"AlexApps99",
"Allison Fleischer",
"AllyTally",
"Christoph B{hmwalder",
"Charlie Bruce",
"Brian Callahan",
"Dav999",
"Allison Fleischer",
"Charlie Bruce",
"Christoph B{hmwalder",
"Daniel Lee",
"Fredrik Ljungdahl",
"MAO3J1m0Op",
"Nichole Mattera",
"Matt Penny",
"Tynan Richards",
"Dav999",
"Elijah Stone",
"Elliott Saltar",
"Marvin Scholz",
"Emmanuel Vadot",
"Fredrik Ljungdahl",
"Keith Stellyes",
"Elijah Stone",
"Thomas S|nger",
"Info Teddy",
"KyoZM",
"leo60228",
"Emmanuel Vadot",
"MAO3J1m0Op",
"Malte Grimm",
"Marvin Scholz",
"Matt Penny",
"mothbeanie",
"Nichole Mattera",
"Pierre-Alain TORET",
"Reese Rivers",
"Remi Verschelde", // TODO: Change to "Rรฉmi" if/when UTF-8 support is added
"viri",
"Thomas S|nger",
"Tynan Richards",
"Wouter",
"viri",
"Vittorio Romeo",
};
/* Calculate credits length, finally. */
static const int creditmaxposition = 1050 + (10 * (
static const int creditmaxposition = 1040 + (10 * (
SDL_arraysize(superpatrons) + SDL_arraysize(patrons) + SDL_arraysize(githubfriends)
));
}; /* namespace Credits */
} /* namespace Credits */
#endif /* CREDITS_H */

@ -0,0 +1,84 @@
#include "DeferCallbacks.h"
#include <SDL.h>
/* Callbacks to be deferred to the end of each sequence of gamestate functions
* in main. Useful for fixing frame-flicker glitches when doing a state
* transition in a function that gets executed before the render function.
*
* We store a linked list of callbacks, to allow for the possibility of having
* more than one callback active at a time (otherwise we could easily just
* have a single pointer here and the header would only be 1 line and an
* include guard) and to do it without having to allocate memory at runtime.
*/
static struct DEFER_Callback* head = NULL;
/* Add a callback. Don't call this directly; use the DEFER_CALLBACK macro. */
void DEFER_add_callback(struct DEFER_Callback* callback)
{
struct DEFER_Callback* node;
/* Are we adding the first node? */
if (head == NULL)
{
head = callback;
return;
}
/* Time to walk the linked list */
node = head;
if (node == callback)
{
goto fail;
}
while (node->next != NULL)
{
node = node->next;
if (node == callback)
{
goto fail;
}
}
/* We're at the end */
node->next = callback;
/* Success! */
return;
fail:
/* Having multiple instances of a callback isn't well-defined
* and is a bit complicated to reason about */
SDL_assert(0 && "Duplicate callback added!");
}
/* Call each callback in the list, along with deleting the entire list. */
void DEFER_execute_callbacks(void)
{
struct DEFER_Callback* node = head;
struct DEFER_Callback* next;
head = NULL;
if (node == NULL)
{
return;
}
next = node->next;
node->func();
node->next = NULL;
while (next != NULL)
{
node = next;
next = node->next;
node->func();
node->next = NULL;
}
}

@ -0,0 +1,31 @@
#ifndef DEFERCALLBACKS_H
#define DEFERCALLBACKS_H
#ifdef __cplusplus
extern "C"
{
#endif
struct DEFER_Callback
{
void (*func)(void);
struct DEFER_Callback* next;
};
void DEFER_add_callback(struct DEFER_Callback* callback);
void DEFER_execute_callbacks(void);
#define DEFER_CALLBACK(FUNC) \
do \
{ \
static struct DEFER_Callback callback = {FUNC, NULL}; \
\
DEFER_add_callback(&callback); \
} while (0)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* DEFERCALLBACKS_H */

@ -3,7 +3,12 @@
#include "Game.h"
#include "Graphics.h"
entclass::entclass()
entclass::entclass(void)
{
clear();
}
void entclass::clear(void)
{
invis = false;
type = 0;
@ -41,6 +46,11 @@ entclass::entclass()
gravity = false;
onground = 0;
onroof = 0;
collisionframedelay = 0;
collisiondrawframe = 0;
collisionwalkingframe = 0;
visualonground = 0;
visualonroof = 0;
onentity = 0;
harmful = false;
@ -60,7 +70,7 @@ entclass::entclass()
lerpoldyp = 0;
}
bool entclass::outside()
bool entclass::outside(void)
{
// Returns true if any point of the entity is outside the map.
// Adjusts velocity for a clean collision.
@ -598,7 +608,7 @@ void entclass::settreadmillcolour( int rx, int ry )
}
}
void entclass::updatecolour()
void entclass::updatecolour(void)
{
switch (size)
{
@ -645,7 +655,7 @@ void entclass::updatecolour()
}
}
bool entclass::ishumanoid()
bool entclass::ishumanoid(void)
{
return type == 0
|| type == 12

@ -8,9 +8,10 @@
class entclass
{
public:
entclass();
entclass(void);
void clear(void);
bool outside();
bool outside(void);
void setenemy(int t);
@ -18,9 +19,9 @@ public:
void settreadmillcolour(int rx, int ry);
void updatecolour();
void updatecolour(void);
bool ishumanoid();
bool ishumanoid(void);
public:
//Fundamentals
@ -48,6 +49,8 @@ public:
int onground, onroof;
//Animation
int framedelay, drawframe, walkingframe, dir, actionframe;
int collisionframedelay, collisiondrawframe, collisionwalkingframe;
int visualonground, visualonroof;
int yp;int xp;
Uint32 realcol;

File diff suppressed because it is too large Load Diff

@ -10,23 +10,6 @@
#include "BlockV.h"
#include "Game.h"
#define removeentity_iter(index) \
do \
{ \
extern entityclass obj; \
if (obj.removeentity(index)) \
{ \
index--; \
} \
} while (false)
#define removeblock_iter(index) \
do \
{ \
extern entityclass obj; \
obj.removeblock(index); \
index--; \
} while (false)
enum
{
BLOCK = 0,
@ -40,23 +23,23 @@ enum
class entityclass
{
public:
void init();
void init(void);
void resetallflags();
void resetallflags(void);
void fatal_top()
void fatal_top(void)
{
createblock(DAMAGE, -8, -8, 384, 16);
}
void fatal_bottom()
void fatal_bottom(void)
{
createblock(DAMAGE, -8, 224, 384, 16);
}
void fatal_left()
void fatal_left(void)
{
createblock(DAMAGE, -8, -8, 16, 260);
}
void fatal_right()
void fatal_right(void)
{
createblock(DAMAGE, 312, -8, 16, 260);
}
@ -71,18 +54,16 @@ public:
void createblock(int t, int xp, int yp, int w, int h, int trig = 0, const std::string& script = "");
bool removeentity(int t);
bool disableentity(int t);
void removeallblocks();
void removeallblocks(void);
void removeblock(int t);
void disableblock(int t);
void removeblockat(int x, int y);
void disableblockat(int x, int y);
void moveblockto(int x1, int y1, int x2, int y2, int w, int h);
void nocollisionat(int x, int y);
void removetrigger(int t);
void copylinecross(int t);
@ -93,25 +74,34 @@ public:
int crewcolour(int t);
void createentity(float xp, float yp, int t, float vx = 0, float vy = 0,
int p1 = 0, int p2 = 0, int p3 = 320, int p4 = 240 );
void createentity(int xp, int yp, int t, int meta1, int meta2,
int p1, int p2, int p3, int p4);
void createentity(int xp, int yp, int t, int meta1, int meta2,
int p1, int p2);
void createentity(int xp, int yp, int t, int meta1, int meta2,
int p1);
void createentity(int xp, int yp, int t, int meta1, int meta2);
void createentity(int xp, int yp, int t, int meta1);
void createentity(int xp, int yp, int t);
bool updateentities(int i);
void animateentities(int i);
int getcompanion();
void animatehumanoidcollision(const int i);
int getcompanion(void);
int getplayer();
int getplayer(void);
int getscm();
int getscm(void);
int getlineat(int t);