Vendor the Shockolate engine and build it via a Docker image with every
build / build (push) Failing after 5s
build / build (push) Failing after 5s
dependency (SDL2, SDL2_mixer, fluidsynth-lite, a MIDI soundfont) prebuilt, so compiling the engine needs no network access - just the image and the engine source. Add res/assets/extract_assets.sh to pull the game's data files out of a purchased GOG installer, and a Makefile that assembles a runnable dist/ from the two. Also add `make package`, which builds a redistributable tarball that omits the proprietary game assets (shipping res/GET_ASSETS.txt instead) plus license information for both the MIT tooling and the GPLv3 engine, and a Gitea Actions workflow that builds and publishes it to dl.ladkau.de on every push.
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/RES/
|
||||
build
|
||||
CMakeLists.txt.user
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# CMake
|
||||
CMakeFiles
|
||||
src/Libraries/CMakeFiles
|
||||
|
||||
**/CMakeCache.txt
|
||||
**/cmake_install.cmake
|
||||
**/Makefile
|
||||
|
||||
TestSimpleMain
|
||||
**/core
|
||||
|
||||
# 3rd Party builds
|
||||
build_ext
|
||||
|
||||
# Save files
|
||||
CurrentGame.dat
|
||||
savgam*.dat
|
||||
|
||||
# Temporary audio files
|
||||
.temp.audio
|
||||
|
||||
# Eclipse CDT
|
||||
.project
|
||||
.cproject
|
||||
.DS_Store
|
||||
@@ -0,0 +1,83 @@
|
||||
language: c
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: bionic
|
||||
sudo: required
|
||||
env:
|
||||
- SDL2_LIB=BUNDLED
|
||||
- SDL2_MIXER_LIB=BUNDLED
|
||||
- FLUIDSYNTH_LIB=BUNDLED
|
||||
- BITS=64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- cmake-data cmake libglu1-mesa-dev libgl1-mesa-dev # libfluidsynth-dev libsdl2-dev libsdl2-mixer-dev
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
env:
|
||||
- SDL2_LIB=BUNDLED
|
||||
- SDL2_MIXER_LIB=BUNDLED
|
||||
- FLUIDSYNTH_LIB=BUNDLED
|
||||
- CMAKE_LIBRARY_PATH=/usr/lib/i386-linux-gnu
|
||||
- BITS=32
|
||||
before_script:
|
||||
- cp ./CMakeLists.32bit.txt ./CMakeLists.txt
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- cmake-data cmake libx32gcc-4.8-dev libc6-dev-i386 gcc-multilib g++-multilib libglu1-mesa-dev:i386 libgl1-mesa-dev:i386
|
||||
compiler: gcc
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env:
|
||||
- SDL2_LIB=BUNDLED
|
||||
- SDL2_MIXER_LIB=BUNDLED
|
||||
- FLUIDSYNTH_LIB=OFF # Bundled lib failed to compile
|
||||
- BITS=64
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
env:
|
||||
- SDL2_LIB=BUNDLED
|
||||
- SDL2_MIXER_LIB=BUNDLED
|
||||
- FLUIDSYNTH_LIB=OFF # Bundled lib failed to compile
|
||||
- BITS=64
|
||||
|
||||
script:
|
||||
- chmod a+rx ./osx-linux/*.sh
|
||||
- sudo TRAVIS=$TRAVIS ./osx-linux/install_${BITS}bit_sdl.sh
|
||||
- cmake -DENABLE_SDL2=${SDL2_LIB} -DENABLE_SOUND=${SDL2_MIXER_LIB} -DENABLE_FLUIDSYNTH=${FLUIDSYNTH_LIB} .
|
||||
- make -j2 systemshock
|
||||
|
||||
before_deploy:
|
||||
- mkdir -p shockolate
|
||||
- cp systemshock shockolate
|
||||
- cp osx-linux/install_${BITS}bit_sdl.sh shockolate/install_sdl.sh
|
||||
- cp osx-linux/readme_osx_linux.md shockolate
|
||||
- cp osx-linux/run_$TRAVIS_OS_NAME.sh shockolate/run.sh
|
||||
- cp -r shaders shockolate/
|
||||
- cp -r res shockolate/
|
||||
- export PACKAGE_NAME="shockolate-$TRAVIS_OS_NAME-${BITS}bit.tgz"
|
||||
- tar zcfv $PACKAGE_NAME shockolate
|
||||
- rm -r shockolate
|
||||
- mkdir -p shockolate-source
|
||||
- cp -r systemshock/* shockolate-source/
|
||||
- tar zcvf shockolate-source-$TRAVIS_TAG.tar.gz shockolate-source
|
||||
- rm -r shockolate-source
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
skip_cleanup: true
|
||||
overwrite: true
|
||||
api_key:
|
||||
secure: "M8fgLU06LQHZS7cf98dHi8bl0BPsyvQHHDWqBaiWqnOoC4XET4fYibFf9B9Ba64RYw5DqPCGbf2onYcDrrUq0cZBwbJsJoVmajKOsWiPzddAtJrk2/nle0MWtjt6OdwbHtg0dNs36QmQ7oRxrEmQaodMmnQW0PKCZOhMmT2zdU73r9ZJ0g4kkkmAAHgfLWYPkfSb9gMj0bn5BLwwGPXv9+NeDFxVG4DY4qjEqQES9tjabVSbVNHretkFCLr0rCpGDQnEZHCP3Wt5c6MoSRunZbRg0X+IwiI1xCEchw2VQFBQiKZ3D4nJIyrZ96iijUQRnnKz5aoMZXQJZQEsnTaZLM+ZbYnK6iA5KWorILdh1odFhNfUJsvWEmEGlrrIQ9qzcAJaIFFch0HRY1S8+gGOy9tEoIpr0VWNZLg8lJvkiQgQmARrt9O+4wIzXZmQnNQcU/N3nWakI68CND4UWk4xAfA6k/Mq2IWyVu477lYxEN+FcqT7EbpowovOOn7e1rutwKDUtb3jWBHZBESF5TCL/hdwdOGNITaV+ENTHbHbWvK6J+3+sCK62xG0/pqzJk3+j7R9zoDvz+htwse/hhk/F3Sa+MpaJQVqtKVD4nBlY/E7+qd3yCyXQm916V+04evjoKOqXXnOOe5d+a87OquLJ6UaynjRsq6lJY2kZ2/Irmc="
|
||||
file: "$PACKAGE_NAME"
|
||||
on:
|
||||
tags: true
|
||||
repo: Interrupt/systemshock
|
||||
@@ -0,0 +1,423 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
project(shockolate VERSION 0.7.8)
|
||||
|
||||
include(FeatureSummary)
|
||||
|
||||
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
|
||||
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON)
|
||||
|
||||
# Required for stdbool.h
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
# For nullptr in C++
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -m32 ")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -m32 -D__STDC_LIMIT_MACROS")
|
||||
|
||||
option(ENABLE_EXAMPLES "Enable example applications" OFF)
|
||||
add_feature_info(ENABLE_EXAMPLES ENABLE_EXAMPLES "Enable example application (can be broken!)")
|
||||
option(ENABLE_DEBUG_BLIT "Enable debugging blitter" OFF)
|
||||
add_feature_info(ENABLE_DEBUG_BLIT ENABLE_DEBUG_BLIT "Enable debugging blitter")
|
||||
option(ENABLE_OPENGL "Enable OpenGL support" ON)
|
||||
add_feature_info(ENABLE_OPENGL ENABLE_OPENGL "Enable OpenGL support")
|
||||
|
||||
set(ENABLE_SDL2 "BUNDLED" CACHE STRING "Enable SDL2 (ON/BUNDLED, default BUNDLED)")
|
||||
set_property(CACHE ENABLE_SDL2 PROPERTY STRINGS "ON" "BUNDLED")
|
||||
add_feature_info(ENABLE_SDL2 ENABLE_SOUND "Enable SDL2 support")
|
||||
|
||||
set(ENABLE_SOUND "BUNDLED" CACHE STRING "Enable sound support (requires SDL2_mixer) (ON/BUNDLED/OFF, default BUNDLED)")
|
||||
set_property(CACHE ENABLE_SOUND PROPERTY STRINGS "ON" "BUNDLED" "OFF")
|
||||
add_feature_info(ENABLE_SOUND ENABLE_SOUND "Enable sound support (requires SDL2_mixer)")
|
||||
|
||||
set(ENABLE_FLUIDSYNTH "BUNDLED" CACHE STRING "Enable FluidSynth MIDI support (ON/BUNDLED/OFF, default BUNDLED)")
|
||||
set_property(CACHE ENABLE_FLUIDSYNTH PROPERTY STRINGS "ON" "BUNDLED" "OFF")
|
||||
add_feature_info(ENABLE_FLUIDSYNTH ENABLE_FLUIDSYNTH "Enable FluidSynth MIDI support")
|
||||
|
||||
# HAAAAX!!
|
||||
add_definitions(-DSVGA_SUPPORT)
|
||||
|
||||
if(ENABLE_DEBUG_BLIT)
|
||||
add_definitions(-DDEBUGGING_BLIT)
|
||||
endif()
|
||||
|
||||
add_compile_options(-fsigned-char -fno-strict-aliasing)
|
||||
|
||||
# Find OpenGL
|
||||
if(ENABLE_OPENGL)
|
||||
find_package(OpenGL REQUIRED)
|
||||
add_definitions(-DUSE_OPENGL)
|
||||
if(WIN32)
|
||||
list(APPEND OPENGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/built_glew/include)
|
||||
list(APPEND OPENGL_LIBRARIES ${CMAKE_SOURCE_DIR}/build_ext/built_glew/lib/libglew32.dll.a winmm)
|
||||
endif(WIN32)
|
||||
endif(ENABLE_OPENGL)
|
||||
|
||||
if(ENABLE_SDL2 MATCHES "ON")
|
||||
find_package(SDL2 REQUIRED)
|
||||
if(SDL2_FOUND)
|
||||
message(STATUS "SDL2 found: ${SDL2_INCLUDE_DIRS} ${SDL2_LIBRARIES}")
|
||||
endif(SDL2_FOUND)
|
||||
endif(ENABLE_SDL2 MATCHES "ON")
|
||||
if(ENABLE_SDL2 MATCHES "BUNDLED")
|
||||
set(SDL2_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl)
|
||||
find_library(SDL2_LIBRARY SDL2 PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH)
|
||||
find_library(SDL2MAIN_LIBRARY SDL2main PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH)
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_DIR}/include/SDL2)
|
||||
set(SDL2_LIBRARIES "${SDL2MAIN_LIBRARY};${SDL2_LIBRARY}")
|
||||
endif(ENABLE_SDL2 MATCHES "BUNDLED")
|
||||
|
||||
if(ENABLE_SOUND MATCHES "ON")
|
||||
# FIXME applies only for *nix systems
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(SDL2_MIXER REQUIRED SDL2_mixer>=2.0.4)
|
||||
add_definitions(-DUSE_SDL_MIXER=1)
|
||||
endif(ENABLE_SOUND MATCHES "ON")
|
||||
if(ENABLE_SOUND MATCHES "BUNDLED")
|
||||
set(SDL2_MIXER_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl_mixer)
|
||||
set(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_DIR}/include/SDL2)
|
||||
find_library(SDL2_MIXER_LIBRARY SDL2_mixer PATHS ${SDL2_MIXER_DIR}/lib)
|
||||
set(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY})
|
||||
add_definitions(-DUSE_SDL_MIXER=1)
|
||||
endif(ENABLE_SOUND MATCHES "BUNDLED")
|
||||
|
||||
if(ENABLE_FLUIDSYNTH MATCHES "ON")
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(FLUIDSYNTH REQUIRED fluidsynth)
|
||||
add_definitions("-DUSE_FLUIDSYNTH=1")
|
||||
endif(ENABLE_FLUIDSYNTH MATCHES "ON")
|
||||
if(ENABLE_FLUIDSYNTH MATCHES "BUNDLED")
|
||||
find_library(FLUIDSYNTH_LIBRARY fluidsynth PATHS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/src)
|
||||
set(FLUIDSYNTH_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/include)
|
||||
set(FLUIDSYNTH_LIBRARIES ${FLUIDSYNTH_LIBRARY})
|
||||
add_definitions("-DUSE_FLUIDSYNTH=1")
|
||||
endif(ENABLE_FLUIDSYNTH MATCHES "BUNDLED")
|
||||
|
||||
include_directories(
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
${SDL2_MIXER_INCLUDE_DIRS}
|
||||
${FLUIDSYNTH_INCLUDE_DIRS}
|
||||
${OPENGL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(NOT WIN32)
|
||||
# Find ALSA for Linux native MIDI
|
||||
# NOTE: this seems to require having 64-bit dev pacakges installed when building
|
||||
# on 64-bit OS, even when building a 32-bit binary
|
||||
find_package(ALSA)
|
||||
if(ALSA_FOUND)
|
||||
message(STATUS "ALSA found")
|
||||
include_directories(${ALSA_INCLUDE_DIRS})
|
||||
add_definitions(-DUSE_ALSA=1)
|
||||
endif(ALSA_FOUND)
|
||||
endif(NOT WIN32)
|
||||
|
||||
# Generate version based on project version
|
||||
set(PROJECT_REVERSION_STRING "")
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE git_describe_out
|
||||
ERROR_VARIABLE git_describe_error
|
||||
RESULT_VARIABLE git_describe_result
|
||||
)
|
||||
string(REGEX MATCH "[a-z|0-9|.]*-[0-9]*-g([a-z|0-9]*)([-|a-z]*)" git_commit "${git_describe_out}")
|
||||
set(git_commit ${CMAKE_MATCH_1})
|
||||
set(git_dirty ${CMAKE_MATCH_2})
|
||||
set(PROJECT_REVERSION_STRING "-g${git_commit}${git_dirty}")
|
||||
endif(GIT_FOUND)
|
||||
|
||||
message(STATUS "Version is ${PROJECT_VERSION}${PROJECT_REVERSION_STRING}")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/src/GameSrc/Headers/shockolate_version.h.in"
|
||||
"${CMAKE_BINARY_DIR}/src/GameSrc/Headers/shockolate_version.h" )
|
||||
|
||||
# Configuration done. Print features
|
||||
feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
|
||||
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
|
||||
|
||||
# Sources configuration
|
||||
add_subdirectory(src/Libraries/)
|
||||
|
||||
set(MAC_SRC
|
||||
src/MacSrc/ShockBitmap.c
|
||||
src/MacSrc/InitMac.c
|
||||
src/MacSrc/Shock.c
|
||||
src/MacSrc/Prefs.c
|
||||
src/MacSrc/MacTune.c
|
||||
src/MacSrc/SDLSound.c
|
||||
src/MacSrc/Modding.c
|
||||
src/MacSrc/OpenGL.cc
|
||||
src/MacSrc/Xmi.c
|
||||
src/MusicSrc/MusicDevice.c
|
||||
)
|
||||
|
||||
set(GAME_SRC
|
||||
src/GameSrc/ai.c
|
||||
src/GameSrc/airupt.c
|
||||
src/GameSrc/amap.c
|
||||
src/GameSrc/amaploop.c
|
||||
src/GameSrc/ammomfd.c
|
||||
src/GameSrc/anim.c
|
||||
src/GameSrc/archiveformat.c
|
||||
src/GameSrc/audiolog.c
|
||||
src/GameSrc/automap.c
|
||||
src/GameSrc/bark.c
|
||||
src/GameSrc/biohelp.c
|
||||
src/GameSrc/cardmfd.c
|
||||
src/GameSrc/citres.c
|
||||
src/GameSrc/combat.c
|
||||
src/GameSrc/cone.c
|
||||
src/GameSrc/criterr.c
|
||||
src/GameSrc/cyber.c
|
||||
src/GameSrc/cybermfd.c
|
||||
src/GameSrc/cybmem.c
|
||||
src/GameSrc/cybrnd.c
|
||||
src/GameSrc/cutsloop.c
|
||||
src/GameSrc/damage.c
|
||||
src/GameSrc/digifx.c
|
||||
src/GameSrc/drugs.c
|
||||
src/GameSrc/effect.c
|
||||
src/GameSrc/email.c
|
||||
src/GameSrc/faceobj.c
|
||||
src/GameSrc/fixtrmfd.c
|
||||
src/GameSrc/frcamera.c
|
||||
src/GameSrc/frclip.c
|
||||
src/GameSrc/frcompil.c
|
||||
src/GameSrc/frmain.c
|
||||
src/GameSrc/frobj.c
|
||||
src/GameSrc/froslew.c
|
||||
src/GameSrc/frpipe.c
|
||||
src/GameSrc/frpts.c
|
||||
src/GameSrc/frsetup.c
|
||||
src/GameSrc/frtables.c
|
||||
src/GameSrc/frterr.c
|
||||
src/GameSrc/frutil.c
|
||||
src/GameSrc/FrUtils.c
|
||||
src/GameSrc/fullamap.c
|
||||
src/GameSrc/fullscrn.c
|
||||
src/GameSrc/gameloop.c
|
||||
src/GameSrc/gameobj.c
|
||||
src/GameSrc/gamesort.c
|
||||
src/GameSrc/gamestrn.c
|
||||
src/GameSrc/gamesys.c
|
||||
src/GameSrc/gametime.c
|
||||
src/GameSrc/gamewrap.c
|
||||
src/GameSrc/gearmfd.c
|
||||
src/GameSrc/gr2ss.c
|
||||
src/GameSrc/grenades.c
|
||||
src/GameSrc/hand.c
|
||||
src/GameSrc/hflip.c
|
||||
src/GameSrc/hkeyfunc.c
|
||||
src/GameSrc/hud.c
|
||||
src/GameSrc/hudobj.c
|
||||
src/GameSrc/init.c
|
||||
src/GameSrc/input.c
|
||||
src/GameSrc/invent.c
|
||||
src/GameSrc/leanmetr.c
|
||||
src/GameSrc/mainloop.c
|
||||
src/GameSrc/map.c
|
||||
src/GameSrc/mfdfunc.c
|
||||
src/GameSrc/mfdgadg.c
|
||||
src/GameSrc/mfdgames.c
|
||||
src/GameSrc/mfdgump.c
|
||||
src/GameSrc/mfdpanel.c
|
||||
src/GameSrc/minimax.c
|
||||
src/GameSrc/mlimbs.c
|
||||
src/GameSrc/movekeys.c
|
||||
src/GameSrc/musicai.c
|
||||
src/GameSrc/newai.c
|
||||
src/GameSrc/newmfd.c
|
||||
src/GameSrc/objapp.c
|
||||
src/GameSrc/objects.c
|
||||
src/GameSrc/objload.c
|
||||
src/GameSrc/objprop.c
|
||||
src/GameSrc/objsim.c
|
||||
src/GameSrc/objuse.c
|
||||
src/GameSrc/olh.c
|
||||
src/GameSrc/olhscan.c
|
||||
src/GameSrc/palfx.c
|
||||
src/GameSrc/pathfind.c
|
||||
src/GameSrc/physics.c
|
||||
src/GameSrc/player.c
|
||||
src/GameSrc/plotware.c
|
||||
src/GameSrc/popups.c
|
||||
src/GameSrc/render.c
|
||||
src/GameSrc/rendtool.c
|
||||
src/GameSrc/saveload.c
|
||||
src/GameSrc/schedule.c
|
||||
src/GameSrc/screen.c
|
||||
src/GameSrc/setup.c
|
||||
src/GameSrc/shodan.c
|
||||
src/GameSrc/sideicon.c
|
||||
src/GameSrc/sndcall.c
|
||||
src/GameSrc/star.c
|
||||
src/GameSrc/statics.c
|
||||
src/GameSrc/status.c
|
||||
src/GameSrc/target.c
|
||||
src/GameSrc/textmaps.c
|
||||
src/GameSrc/tickcount.c
|
||||
src/GameSrc/tfdirect.c
|
||||
src/GameSrc/tfutil.c
|
||||
src/GameSrc/tools.c
|
||||
src/GameSrc/trigger.c
|
||||
src/GameSrc/view360.c
|
||||
src/GameSrc/viewhelp.c
|
||||
src/GameSrc/vitals.c
|
||||
src/GameSrc/vmail.c
|
||||
src/GameSrc/wares.c
|
||||
src/GameSrc/weapons.c
|
||||
src/GameSrc/wrapper.c
|
||||
src/GameSrc/gamerend.c
|
||||
src/GameSrc/mouselook.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
BEFORE
|
||||
src/Libraries/2D/Source
|
||||
src/Libraries/3D/Source
|
||||
src/Libraries/AFILE/Source
|
||||
src/Libraries/DSTRUCT/Source
|
||||
src/Libraries/EDMS/Source
|
||||
src/Libraries/FIXPP/Source
|
||||
src/Libraries/INPUT/Source
|
||||
src/Libraries/PALETTE/Source
|
||||
src/Libraries/RES/Source
|
||||
src/Libraries/UI/Source
|
||||
src/Libraries/RND/Source
|
||||
src/Libraries/VOX/Source
|
||||
src/Libraries/FIX/Source
|
||||
src/Libraries/SND/Source
|
||||
src/Libraries/H
|
||||
src/Libraries/LG/Source
|
||||
src/Libraries/LG/Source/LOG/src
|
||||
src/Libraries/adlmidi/include
|
||||
src/GameSrc/Headers
|
||||
src/MacSrc
|
||||
src/MusicSrc
|
||||
${CMAKE_BINARY_DIR}/src/GameSrc/Headers
|
||||
)
|
||||
|
||||
if(ENABLE_EXAMPLES)
|
||||
|
||||
add_executable(playmov
|
||||
src/Libraries/AFILE/Tests/playmov.c
|
||||
)
|
||||
add_executable(movinfo
|
||||
src/Libraries/AFILE/Tests/movinfo.c
|
||||
)
|
||||
|
||||
target_link_libraries(playmov
|
||||
AFILE_LIB
|
||||
FIX_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_MIXER_LIBRARIES}
|
||||
)
|
||||
|
||||
target_link_libraries(movinfo
|
||||
AFILE_LIB
|
||||
FIX_LIB
|
||||
)
|
||||
|
||||
add_executable(TestSimpleMain
|
||||
src/Libraries/2D/TestSource/SimpleMain.c
|
||||
)
|
||||
|
||||
target_link_libraries(TestSimpleMain
|
||||
2D_LIB
|
||||
GR_LIB
|
||||
3D_LIB
|
||||
RES_LIB
|
||||
FIX_LIB
|
||||
LG_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(BoxTest
|
||||
src/Libraries/3D/Tests/BoxTest.c
|
||||
)
|
||||
|
||||
target_link_libraries(BoxTest
|
||||
2D_LIB
|
||||
GR_LIB
|
||||
3D_LIB
|
||||
RES_LIB
|
||||
FIX_LIB
|
||||
LG_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(BitmapTest
|
||||
src/Libraries/3D/Tests/BitmapTest.c
|
||||
)
|
||||
|
||||
target_link_libraries(BitmapTest
|
||||
2D_LIB
|
||||
GR_LIB
|
||||
3D_LIB
|
||||
RES_LIB
|
||||
FIX_LIB
|
||||
LG_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(FixTest
|
||||
src/Libraries/FIX/Tests/FixTest/fixtest.c
|
||||
)
|
||||
|
||||
target_link_libraries(FixTest
|
||||
FIX_LIB
|
||||
LG_LIB
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# Include magic header file, set struct packing size
|
||||
add_definitions(
|
||||
-include precompiled.h
|
||||
)
|
||||
|
||||
add_executable(systemshock
|
||||
${MAC_SRC}
|
||||
)
|
||||
|
||||
add_library(GAME_LIB ${GAME_SRC})
|
||||
|
||||
# MINGW additional linker options
|
||||
if(MINGW)
|
||||
set(WINDOWS_LIBRARIES "mingw32 -mwindows")
|
||||
endif(MINGW)
|
||||
|
||||
target_link_libraries(systemshock
|
||||
${WINDOWS_LIBRARIES} # Set it before any linker options! Beware WinMain@16 error!!
|
||||
GAME_LIB
|
||||
UI_LIB
|
||||
2D_LIB
|
||||
LG_LIB
|
||||
GR_LIB
|
||||
3D_LIB
|
||||
RND_LIB
|
||||
AFILE_LIB
|
||||
DSTRUCT_LIB
|
||||
FIX_LIB
|
||||
INPUT_LIB
|
||||
PALETTE_LIB
|
||||
RES_LIB
|
||||
# SND_LIB
|
||||
VOX_LIB
|
||||
EDMS_LIB
|
||||
FIXPP_LIB
|
||||
ADLMIDI_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_MIXER_LIBRARIES}
|
||||
${FLUIDSYNTH_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${ALSA_LIBRARIES}
|
||||
)
|
||||
|
||||
# Turn on address sanitizing if wanted
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/sanitizers/cmake" ${CMAKE_MODULE_PATH})
|
||||
find_package(Sanitizers)
|
||||
add_sanitizers(systemshock)
|
||||
|
||||
@@ -0,0 +1,424 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
project(shockolate VERSION 0.7.8)
|
||||
|
||||
include(FeatureSummary)
|
||||
|
||||
#set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
|
||||
#set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON)
|
||||
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS OFF)
|
||||
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
|
||||
|
||||
# Required for stdbool.h
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
# For nullptr in C++
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g ")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -D__STDC_LIMIT_MACROS")
|
||||
|
||||
option(ENABLE_EXAMPLES "Enable example applications" OFF)
|
||||
add_feature_info(ENABLE_EXAMPLES ENABLE_EXAMPLES "Enable example application (can be broken!)")
|
||||
option(ENABLE_DEBUG_BLIT "Enable debugging blitter" OFF)
|
||||
add_feature_info(ENABLE_DEBUG_BLIT ENABLE_DEBUG_BLIT "Enable debugging blitter")
|
||||
option(ENABLE_OPENGL "Enable OpenGL support" ON)
|
||||
add_feature_info(ENABLE_OPENGL ENABLE_OPENGL "Enable OpenGL support")
|
||||
|
||||
set(ENABLE_SDL2 "BUNDLED" CACHE STRING "Enable SDL2 (ON/BUNDLED, default BUNDLED)")
|
||||
set_property(CACHE ENABLE_SDL2 PROPERTY STRINGS "ON" "BUNDLED")
|
||||
add_feature_info(ENABLE_SDL2 ENABLE_SOUND "Enable SDL2 support")
|
||||
|
||||
set(ENABLE_SOUND "BUNDLED" CACHE STRING "Enable sound support (requires SDL2_mixer) (ON/BUNDLED/OFF, default BUNDLED)")
|
||||
set_property(CACHE ENABLE_SOUND PROPERTY STRINGS "ON" "BUNDLED" "OFF")
|
||||
add_feature_info(ENABLE_SOUND ENABLE_SOUND "Enable sound support (requires SDL2_mixer)")
|
||||
|
||||
set(ENABLE_FLUIDSYNTH "BUNDLED" CACHE STRING "Enable FluidSynth MIDI support (ON/BUNDLED/OFF, default BUNDLED)")
|
||||
set_property(CACHE ENABLE_FLUIDSYNTH PROPERTY STRINGS "ON" "BUNDLED" "OFF")
|
||||
add_feature_info(ENABLE_FLUIDSYNTH ENABLE_FLUIDSYNTH "Enable FluidSynth MIDI support")
|
||||
|
||||
# HAAAAX!!
|
||||
add_definitions(-DSVGA_SUPPORT)
|
||||
|
||||
if(ENABLE_DEBUG_BLIT)
|
||||
add_definitions(-DDEBUGGING_BLIT)
|
||||
endif()
|
||||
|
||||
add_compile_options(-fsigned-char -fno-strict-aliasing)
|
||||
|
||||
# Find OpenGL
|
||||
if(ENABLE_OPENGL)
|
||||
find_package(OpenGL REQUIRED)
|
||||
add_definitions(-DUSE_OPENGL)
|
||||
if(WIN32)
|
||||
list(APPEND OPENGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/built_glew/include)
|
||||
list(APPEND OPENGL_LIBRARIES ${CMAKE_SOURCE_DIR}/build_ext/built_glew/lib/libglew32.dll.a winmm)
|
||||
endif(WIN32)
|
||||
endif(ENABLE_OPENGL)
|
||||
|
||||
if(ENABLE_SDL2 MATCHES "ON")
|
||||
find_package(SDL2 REQUIRED)
|
||||
if(SDL2_FOUND)
|
||||
message(STATUS "SDL2 found: ${SDL2_INCLUDE_DIRS} ${SDL2_LIBRARIES}")
|
||||
endif(SDL2_FOUND)
|
||||
endif(ENABLE_SDL2 MATCHES "ON")
|
||||
if(ENABLE_SDL2 MATCHES "BUNDLED")
|
||||
set(SDL2_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl)
|
||||
find_library(SDL2_LIBRARY SDL2 PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH)
|
||||
find_library(SDL2MAIN_LIBRARY SDL2main PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH)
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_DIR}/include/SDL2)
|
||||
set(SDL2_LIBRARIES "${SDL2MAIN_LIBRARY};${SDL2_LIBRARY}")
|
||||
endif(ENABLE_SDL2 MATCHES "BUNDLED")
|
||||
|
||||
if(ENABLE_SOUND MATCHES "ON")
|
||||
# FIXME applies only for *nix systems
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(SDL2_MIXER REQUIRED SDL2_mixer>=2.0.4)
|
||||
add_definitions(-DUSE_SDL_MIXER=1)
|
||||
endif(ENABLE_SOUND MATCHES "ON")
|
||||
if(ENABLE_SOUND MATCHES "BUNDLED")
|
||||
set(SDL2_MIXER_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl_mixer)
|
||||
set(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_DIR}/include/SDL2)
|
||||
find_library(SDL2_MIXER_LIBRARY SDL2_mixer PATHS ${SDL2_MIXER_DIR}/lib)
|
||||
set(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY})
|
||||
add_definitions(-DUSE_SDL_MIXER=1)
|
||||
endif(ENABLE_SOUND MATCHES "BUNDLED")
|
||||
|
||||
if(ENABLE_FLUIDSYNTH MATCHES "ON")
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(FLUIDSYNTH REQUIRED fluidsynth)
|
||||
add_definitions("-DUSE_FLUIDSYNTH=1")
|
||||
endif(ENABLE_FLUIDSYNTH MATCHES "ON")
|
||||
if(ENABLE_FLUIDSYNTH MATCHES "BUNDLED")
|
||||
find_library(FLUIDSYNTH_LIBRARY fluidsynth PATHS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/src)
|
||||
set(FLUIDSYNTH_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/include)
|
||||
set(FLUIDSYNTH_LIBRARIES ${FLUIDSYNTH_LIBRARY})
|
||||
add_definitions("-DUSE_FLUIDSYNTH=1")
|
||||
endif(ENABLE_FLUIDSYNTH MATCHES "BUNDLED")
|
||||
|
||||
include_directories(
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
${SDL2_MIXER_INCLUDE_DIRS}
|
||||
${FLUIDSYNTH_INCLUDE_DIRS}
|
||||
${OPENGL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(NOT WIN32)
|
||||
# Find ALSA for Linux native MIDI
|
||||
# NOTE: this seems to require having 64-bit dev pacakges installed when building
|
||||
# on 64-bit OS, even when building a 32-bit binary
|
||||
find_package(ALSA)
|
||||
if(ALSA_FOUND)
|
||||
message(STATUS "ALSA found")
|
||||
include_directories(${ALSA_INCLUDE_DIRS})
|
||||
add_definitions(-DUSE_ALSA=1)
|
||||
endif(ALSA_FOUND)
|
||||
endif(NOT WIN32)
|
||||
|
||||
# Generate version based on project version
|
||||
set(PROJECT_REVERSION_STRING "")
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE git_describe_out
|
||||
ERROR_VARIABLE git_describe_error
|
||||
RESULT_VARIABLE git_describe_result
|
||||
)
|
||||
string(REGEX MATCH "[a-z|0-9|.]*-[0-9]*-g([a-z|0-9]*)([-|a-z]*)" git_commit "${git_describe_out}")
|
||||
set(git_commit ${CMAKE_MATCH_1})
|
||||
set(git_dirty ${CMAKE_MATCH_2})
|
||||
set(PROJECT_REVERSION_STRING "-g${git_commit}${git_dirty}")
|
||||
endif(GIT_FOUND)
|
||||
|
||||
message(STATUS "Version is ${PROJECT_VERSION}${PROJECT_REVERSION_STRING}")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/src/GameSrc/Headers/shockolate_version.h.in"
|
||||
"${CMAKE_BINARY_DIR}/src/GameSrc/Headers/shockolate_version.h" )
|
||||
|
||||
# Configuration done. Print features
|
||||
feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
|
||||
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
|
||||
|
||||
# Sources configuration
|
||||
add_subdirectory(src/Libraries/)
|
||||
|
||||
set(MAC_SRC
|
||||
src/MacSrc/ShockBitmap.c
|
||||
src/MacSrc/InitMac.c
|
||||
src/MacSrc/Shock.c
|
||||
src/MacSrc/Prefs.c
|
||||
src/MacSrc/MacTune.c
|
||||
src/MacSrc/SDLSound.c
|
||||
src/MacSrc/Modding.c
|
||||
src/MacSrc/OpenGL.cc
|
||||
src/MacSrc/Xmi.c
|
||||
src/MusicSrc/MusicDevice.c
|
||||
)
|
||||
|
||||
set(GAME_SRC
|
||||
src/GameSrc/ai.c
|
||||
src/GameSrc/airupt.c
|
||||
src/GameSrc/amap.c
|
||||
src/GameSrc/amaploop.c
|
||||
src/GameSrc/ammomfd.c
|
||||
src/GameSrc/anim.c
|
||||
src/GameSrc/archiveformat.c
|
||||
src/GameSrc/audiolog.c
|
||||
src/GameSrc/automap.c
|
||||
src/GameSrc/bark.c
|
||||
src/GameSrc/biohelp.c
|
||||
src/GameSrc/cardmfd.c
|
||||
src/GameSrc/citres.c
|
||||
src/GameSrc/combat.c
|
||||
src/GameSrc/cone.c
|
||||
src/GameSrc/criterr.c
|
||||
src/GameSrc/cyber.c
|
||||
src/GameSrc/cybermfd.c
|
||||
src/GameSrc/cybmem.c
|
||||
src/GameSrc/cybrnd.c
|
||||
src/GameSrc/cutsloop.c
|
||||
src/GameSrc/damage.c
|
||||
src/GameSrc/digifx.c
|
||||
src/GameSrc/drugs.c
|
||||
src/GameSrc/effect.c
|
||||
src/GameSrc/email.c
|
||||
src/GameSrc/faceobj.c
|
||||
src/GameSrc/fixtrmfd.c
|
||||
src/GameSrc/frcamera.c
|
||||
src/GameSrc/frclip.c
|
||||
src/GameSrc/frcompil.c
|
||||
src/GameSrc/frmain.c
|
||||
src/GameSrc/frobj.c
|
||||
src/GameSrc/froslew.c
|
||||
src/GameSrc/frpipe.c
|
||||
src/GameSrc/frpts.c
|
||||
src/GameSrc/frsetup.c
|
||||
src/GameSrc/frtables.c
|
||||
src/GameSrc/frterr.c
|
||||
src/GameSrc/frutil.c
|
||||
src/GameSrc/FrUtils.c
|
||||
src/GameSrc/fullamap.c
|
||||
src/GameSrc/fullscrn.c
|
||||
src/GameSrc/gameloop.c
|
||||
src/GameSrc/gameobj.c
|
||||
src/GameSrc/gamesort.c
|
||||
src/GameSrc/gamestrn.c
|
||||
src/GameSrc/gamesys.c
|
||||
src/GameSrc/gametime.c
|
||||
src/GameSrc/gamewrap.c
|
||||
src/GameSrc/gearmfd.c
|
||||
src/GameSrc/gr2ss.c
|
||||
src/GameSrc/grenades.c
|
||||
src/GameSrc/hand.c
|
||||
src/GameSrc/hflip.c
|
||||
src/GameSrc/hkeyfunc.c
|
||||
src/GameSrc/hud.c
|
||||
src/GameSrc/hudobj.c
|
||||
src/GameSrc/init.c
|
||||
src/GameSrc/input.c
|
||||
src/GameSrc/invent.c
|
||||
src/GameSrc/leanmetr.c
|
||||
src/GameSrc/mainloop.c
|
||||
src/GameSrc/map.c
|
||||
src/GameSrc/mfdfunc.c
|
||||
src/GameSrc/mfdgadg.c
|
||||
src/GameSrc/mfdgames.c
|
||||
src/GameSrc/mfdgump.c
|
||||
src/GameSrc/mfdpanel.c
|
||||
src/GameSrc/minimax.c
|
||||
src/GameSrc/mlimbs.c
|
||||
src/GameSrc/movekeys.c
|
||||
src/GameSrc/musicai.c
|
||||
src/GameSrc/newai.c
|
||||
src/GameSrc/newmfd.c
|
||||
src/GameSrc/objapp.c
|
||||
src/GameSrc/objects.c
|
||||
src/GameSrc/objload.c
|
||||
src/GameSrc/objprop.c
|
||||
src/GameSrc/objsim.c
|
||||
src/GameSrc/objuse.c
|
||||
src/GameSrc/olh.c
|
||||
src/GameSrc/olhscan.c
|
||||
src/GameSrc/palfx.c
|
||||
src/GameSrc/pathfind.c
|
||||
src/GameSrc/physics.c
|
||||
src/GameSrc/player.c
|
||||
src/GameSrc/plotware.c
|
||||
src/GameSrc/popups.c
|
||||
src/GameSrc/render.c
|
||||
src/GameSrc/rendtool.c
|
||||
src/GameSrc/saveload.c
|
||||
src/GameSrc/schedule.c
|
||||
src/GameSrc/screen.c
|
||||
src/GameSrc/setup.c
|
||||
src/GameSrc/shodan.c
|
||||
src/GameSrc/sideicon.c
|
||||
src/GameSrc/sndcall.c
|
||||
src/GameSrc/star.c
|
||||
src/GameSrc/statics.c
|
||||
src/GameSrc/status.c
|
||||
src/GameSrc/target.c
|
||||
src/GameSrc/textmaps.c
|
||||
src/GameSrc/tickcount.c
|
||||
src/GameSrc/tfdirect.c
|
||||
src/GameSrc/tfutil.c
|
||||
src/GameSrc/tools.c
|
||||
src/GameSrc/trigger.c
|
||||
src/GameSrc/view360.c
|
||||
src/GameSrc/viewhelp.c
|
||||
src/GameSrc/vitals.c
|
||||
src/GameSrc/vmail.c
|
||||
src/GameSrc/wares.c
|
||||
src/GameSrc/weapons.c
|
||||
src/GameSrc/wrapper.c
|
||||
src/GameSrc/gamerend.c
|
||||
src/GameSrc/mouselook.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
BEFORE
|
||||
src/Libraries/2D/Source
|
||||
src/Libraries/3D/Source
|
||||
src/Libraries/AFILE/Source
|
||||
src/Libraries/DSTRUCT/Source
|
||||
src/Libraries/EDMS/Source
|
||||
src/Libraries/FIXPP/Source
|
||||
src/Libraries/INPUT/Source
|
||||
src/Libraries/PALETTE/Source
|
||||
src/Libraries/RES/Source
|
||||
src/Libraries/UI/Source
|
||||
src/Libraries/RND/Source
|
||||
src/Libraries/VOX/Source
|
||||
src/Libraries/FIX/Source
|
||||
src/Libraries/SND/Source
|
||||
src/Libraries/H
|
||||
src/Libraries/LG/Source
|
||||
src/Libraries/LG/Source/LOG/src
|
||||
src/Libraries/adlmidi/include
|
||||
src/GameSrc/Headers
|
||||
src/MacSrc
|
||||
src/MusicSrc
|
||||
${CMAKE_BINARY_DIR}/src/GameSrc/Headers
|
||||
)
|
||||
|
||||
if(ENABLE_EXAMPLES)
|
||||
|
||||
add_executable(playmov
|
||||
src/Libraries/AFILE/Tests/playmov.c
|
||||
)
|
||||
add_executable(movinfo
|
||||
src/Libraries/AFILE/Tests/movinfo.c
|
||||
)
|
||||
|
||||
target_link_libraries(playmov
|
||||
AFILE_LIB
|
||||
FIX_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_MIXER_LIBRARIES}
|
||||
)
|
||||
|
||||
target_link_libraries(movinfo
|
||||
AFILE_LIB
|
||||
FIX_LIB
|
||||
)
|
||||
|
||||
add_executable(TestSimpleMain
|
||||
src/Libraries/2D/TestSource/SimpleMain.c
|
||||
)
|
||||
|
||||
target_link_libraries(TestSimpleMain
|
||||
2D_LIB
|
||||
GR_LIB
|
||||
3D_LIB
|
||||
RES_LIB
|
||||
FIX_LIB
|
||||
LG_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(BoxTest
|
||||
src/Libraries/3D/Tests/BoxTest.c
|
||||
)
|
||||
|
||||
target_link_libraries(BoxTest
|
||||
2D_LIB
|
||||
GR_LIB
|
||||
3D_LIB
|
||||
RES_LIB
|
||||
FIX_LIB
|
||||
LG_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(BitmapTest
|
||||
src/Libraries/3D/Tests/BitmapTest.c
|
||||
)
|
||||
|
||||
target_link_libraries(BitmapTest
|
||||
2D_LIB
|
||||
GR_LIB
|
||||
3D_LIB
|
||||
RES_LIB
|
||||
FIX_LIB
|
||||
LG_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(FixTest
|
||||
src/Libraries/FIX/Tests/FixTest/fixtest.c
|
||||
)
|
||||
|
||||
target_link_libraries(FixTest
|
||||
FIX_LIB
|
||||
LG_LIB
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# Include magic header file, set struct packing size
|
||||
add_definitions(
|
||||
-include precompiled.h
|
||||
)
|
||||
|
||||
add_executable(systemshock
|
||||
${MAC_SRC}
|
||||
)
|
||||
|
||||
add_library(GAME_LIB ${GAME_SRC})
|
||||
|
||||
# MINGW additional linker options
|
||||
if(MINGW)
|
||||
set(WINDOWS_LIBRARIES "mingw32 -mwindows")
|
||||
endif(MINGW)
|
||||
|
||||
target_link_libraries(systemshock
|
||||
${WINDOWS_LIBRARIES} # Set it before any linker options! Beware WinMain@16 error!!
|
||||
GAME_LIB
|
||||
UI_LIB
|
||||
2D_LIB
|
||||
LG_LIB
|
||||
GR_LIB
|
||||
3D_LIB
|
||||
RND_LIB
|
||||
AFILE_LIB
|
||||
DSTRUCT_LIB
|
||||
FIX_LIB
|
||||
INPUT_LIB
|
||||
PALETTE_LIB
|
||||
RES_LIB
|
||||
# SND_LIB
|
||||
VOX_LIB
|
||||
EDMS_LIB
|
||||
FIXPP_LIB
|
||||
ADLMIDI_LIB
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_MIXER_LIBRARIES}
|
||||
${FLUIDSYNTH_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${ALSA_LIBRARIES}
|
||||
)
|
||||
|
||||
# Turn on address sanitizing if wanted
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/sanitizers/cmake" ${CMAKE_MODULE_PATH})
|
||||
find_package(Sanitizers)
|
||||
add_sanitizers(systemshock)
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
+674
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,88 @@
|
||||
Shockolate - System Shock, but cross platform!
|
||||
============================
|
||||
Based on the source code for PowerPC released by Night Dive Studios, Incorporated.
|
||||
|
||||
[](https://travis-ci.org/Interrupt/systemshock) [](https://ci.appveyor.com/project/Interrupt/systemshock)
|
||||
|
||||
GENERAL NOTES
|
||||
=============
|
||||
|
||||
Shockolate is a cross platform source port of System Shock, using SDL2. This runs well on OSX, Linux, and Windows right now, with some missing features that need reviving due to not being included in the source code that was released.
|
||||
|
||||
The end goal for this project is something like what Chocolate Doom is for Doom: an experience that closely mimics the original, but portable and with some quality of life improvements including an OpenGL renderer and mod support!
|
||||
|
||||
Join our Discord to follow along with development: https://discord.gg/m45xPan
|
||||
|
||||

|
||||
|
||||
Prerequisites
|
||||
=======
|
||||
- Original cd-rom or SS:EE assets in a `res/data` folder next to the executable
|
||||
- Floppy disk assets are an older version that we can't load currently
|
||||
|
||||
|
||||
Running
|
||||
=======
|
||||
|
||||
## From a prebuilt package
|
||||
|
||||
Find a list of [downloadable packages](https://github.com/Interrupt/systemshock/releases/) for Linux, Mac and Windows. 32 and 64 bit versions are available for Linux and Windows.
|
||||
|
||||
## From source code
|
||||
|
||||
Prerequisites:
|
||||
- [CMake](https://cmake.org/download/) installed
|
||||
|
||||
Step 1. Build the dependencies:
|
||||
* Windows: `build_win32.sh` or `build_win64.sh` (Git Bash and MinGW recommended)
|
||||
* Linux/Mac: `build_deps.sh` or the CI build scripts in `osx-linux`
|
||||
* Other: `build_deps.sh`
|
||||
|
||||
Step 2. Build and run the game itself
|
||||
```
|
||||
cmake .
|
||||
make systemshock
|
||||
./systemshock
|
||||
```
|
||||
|
||||
The following CMake options are supported in the build process:
|
||||
* `ENABLE_SDL2` - use system or bundled SDL2 (ON/BUNDLED, default BUNDLED)
|
||||
* `ENABLE_SOUND` - enable sound support (requires SDL2_mixer, ON/BUNDLED/OFF, default is BUNDLED)
|
||||
* `ENABLE_FLUIDSYNTH` - enable FluidSynth MIDI support (ON/BUNDLED/OFF, default is BUNDLED)
|
||||
* `ENABLE_OPENGL` - enable OpenGL support (ON/OFF, default ON)
|
||||
|
||||
If you find yourself needing to modify the build script for Shockolate itself, `CMakeLists.txt` is the place to look into.
|
||||
|
||||
|
||||
Command line parameters
|
||||
============
|
||||
|
||||
`-nosplash` Disables the splash screens, causes the game to start straight to the main menu
|
||||
|
||||
Modding Support
|
||||
============
|
||||
Shockolate supports loading mods and full on fan missions. Just point the executable at a mod file or folder and the game will load it in. So far mod loading supports additional `.res` and `.dat` files for resources and missions respectively.
|
||||
|
||||
Run a fan mission from a folder:
|
||||
```
|
||||
./systemshock /Path/To/My/Mission
|
||||
```
|
||||
|
||||
Run a fan mission from specific files:
|
||||
```
|
||||
./systemshock my-archive.dat my-strings.res
|
||||
```
|
||||
|
||||
Control modifications
|
||||
=======
|
||||
|
||||
## Movement
|
||||
|
||||
Shockolate replaces the original game's movement with WASD controls, and uses `F` as the mouselook toggle hotkey. This differs from the Enhanced Edition's usage of `E` as the mouselook hotkey, but allows us to keep `Q` and `E` available for leaning.
|
||||
|
||||
## Additional hotkeys
|
||||
|
||||
* `Ctrl+G` cycles between graphics rendering modes
|
||||
* `Ctrl+F` to enable full screen mode
|
||||
* `Ctrl+D` to disable full screen mode
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,94 @@
|
||||
# Shockolate AppVeyor configuration
|
||||
# YAML format reference: https://www.appveyor.com/docs/appveyor-yml/
|
||||
|
||||
# This determines the disk image AppVeyor uses while building
|
||||
# Despite its name, this image actually contains all sorts of non-VC goodies
|
||||
# See https://www.appveyor.com/docs/build-environment/ for all the details
|
||||
image: Visual Studio 2015
|
||||
|
||||
# Tell build_windows.sh that we're building for AppVeyor
|
||||
environment:
|
||||
APPVEYOR: TRUE
|
||||
|
||||
platform:
|
||||
- x64
|
||||
- x86
|
||||
|
||||
# Avoid rebuilding external dependencies (ie. SDL and SDL_mixer)
|
||||
# Uncache build_ext if external deps change
|
||||
cache:
|
||||
- res/music.sf2
|
||||
- build_ext
|
||||
|
||||
# Set up environment variable values for 32 and 64 bit builds
|
||||
|
||||
for:
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- platform: x86
|
||||
before_build:
|
||||
- set BUILD_SCRIPT=build_win32.sh
|
||||
- set ARTIFACT=systemshock-x86.zip
|
||||
- set MINGW_PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\
|
||||
- copy CMakeLists.32bit.txt CMakeLists.txt
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- platform: x64
|
||||
before_build:
|
||||
- set BUILD_SCRIPT=build_win64.sh
|
||||
- set ARTIFACT=systemshock-x64.zip
|
||||
- set MINGW_PATH=C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\
|
||||
|
||||
# Actual build script..
|
||||
# Step 1: Git has to reside in a path without spaces because the SDL build script is weird like that.
|
||||
# So we create a symlink to the real Git, remove it from PATH and add our own.
|
||||
# Step 2: We need to use our own make.exe to build stuff, so we add that
|
||||
# Step 3: Do the actual building
|
||||
|
||||
build_script:
|
||||
- mklink /D c:\git "C:\Program Files\Git"
|
||||
- set PATH=%PATH:C:\Program Files (x86)\Git\bin;=%
|
||||
- set PATH=c:\git\usr\bin;%PATH%;%MINGW_PATH%
|
||||
- copy windows\make.exe \git\usr\bin
|
||||
- set CMAKE_MAKE_PROGRAM=c:\git\usr\bin\make.exe
|
||||
- sh %BUILD_SCRIPT%
|
||||
- build.bat
|
||||
|
||||
|
||||
# For now, we don't have any automatic tests to run
|
||||
test: off
|
||||
|
||||
# Once building is done, we gather all the necessary DLL files and build our ZIP file.
|
||||
after_build:
|
||||
- copy %MINGW_PATH%\libgcc*.dll .
|
||||
- copy %MINGW_PATH%\libstd*.dll .
|
||||
- copy %MINGW_PATH%\libwinpthread-1.dll .
|
||||
- copy build_ext\built_sdl\bin\SDL*.dll .
|
||||
- copy build_ext\built_sdl_mixer\bin\SDL*.dll .
|
||||
- copy build_ext\built_glew\lib\glew32.dll .
|
||||
- copy build_ext\fluidsynth-lite\src\libfluidsynth.dll .
|
||||
- 7z a %ARTIFACT% systemshock.exe *.dll shaders/ res/
|
||||
|
||||
artifacts:
|
||||
- path: systemshock-x86.zip
|
||||
name: Shockolate (32bit)
|
||||
- path: systemshock-x64.zip
|
||||
name: Shockolate (64bit)
|
||||
|
||||
version: '0.5.{build}'
|
||||
|
||||
# Finally, we deploy the ZIP file as a GitHub release
|
||||
# FIXME: How do we want to be building releases? Seems like this would be better as a manual process
|
||||
# TODO: invent a better versioning scheme for the tag name
|
||||
|
||||
deploy:
|
||||
- provider: GitHub
|
||||
release: $(appveyor_repo_tag_name)
|
||||
description: 'Latest release build of Shockolate'
|
||||
artifact: systemshock-x86.zip, systemshock-x64.zip
|
||||
auth_token:
|
||||
secure: P1kIk8rRxKAYHqDrOWf0Zf5spfR+N86E0lO8VBu99vHtECJgPLn/Z6tBmL9cxPah
|
||||
on:
|
||||
APPVEYOR_REPO_TAG: true
|
||||
@@ -0,0 +1,4 @@
|
||||
@REM Initial build.bat for Appveyor
|
||||
|
||||
cmake -G "Unix Makefiles" .
|
||||
make -j2 systemshock
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SDL_version=2.0.9
|
||||
SDL2_mixer_version=2.0.4
|
||||
|
||||
if [ -d ./build_ext/ ]; then
|
||||
echo A directory named build_ext already exists.
|
||||
echo Please remove it if you want to recompile.
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -d ./res/ ]; then
|
||||
mkdir ./res/
|
||||
fi
|
||||
|
||||
mkdir ./build_ext/
|
||||
cd ./build_ext/
|
||||
|
||||
install_dir=$(pwd)
|
||||
|
||||
function build_sdl {
|
||||
curl -O https://www.libsdl.org/release/SDL2-${SDL_version}.tar.gz
|
||||
tar xvf SDL2-${SDL_version}.tar.gz
|
||||
pushd SDL2-${SDL_version}
|
||||
|
||||
./configure --prefix=${install_dir}/built_sdl
|
||||
make
|
||||
make install
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function build_sdl_mixer {
|
||||
curl -O https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-${SDL2_mixer_version}.tar.gz
|
||||
tar xvf SDL2_mixer-${SDL2_mixer_version}.tar.gz
|
||||
pushd SDL2_mixer-${SDL2_mixer_version}
|
||||
|
||||
export SDL2_CONFIG="${install_dir}/built_sdl/bin/sdl2-config"
|
||||
./configure --prefix=${install_dir}/built_sdl_mixer
|
||||
make
|
||||
make install
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function build_fluidsynth {
|
||||
git clone https://github.com/EtherTyper/fluidsynth-lite.git
|
||||
pushd fluidsynth-lite
|
||||
sed -i 's/DLL"\ off/DLL"\ on/' CMakeLists.txt
|
||||
# if building fluidsynth fails, move on without it
|
||||
set +e
|
||||
|
||||
#export CFLAGS="-m32"
|
||||
#export CXXFLAGS="-m32"
|
||||
|
||||
cmake .
|
||||
cmake --build .
|
||||
|
||||
# download a soundfont that's close to the Windows default everyone knows
|
||||
curl -o music.sf2 http://rancid.kapsi.fi/windows.sf2
|
||||
set -e
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
build_sdl
|
||||
build_sdl_mixer
|
||||
build_fluidsynth
|
||||
|
||||
cd ..
|
||||
mv build_ext/fluidsynth-lite/*.sf2 ./res
|
||||
@@ -0,0 +1,124 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SDL_version=2.0.10
|
||||
SDL2_mixer_version=2.0.4
|
||||
GLEW_version=2.1.0
|
||||
CMAKE_target=Unix\ Makefiles
|
||||
|
||||
# Removing the mwindows linker option lets us get console output
|
||||
function remove_mwindows {
|
||||
sed -i -e "s/ \-mwindows//g" Makefile
|
||||
}
|
||||
|
||||
function build_sdl {
|
||||
curl -O https://www.libsdl.org/release/SDL2-${SDL_version}.tar.gz
|
||||
tar xvf SDL2-${SDL_version}.tar.gz
|
||||
pushd SDL2-${SDL_version}
|
||||
|
||||
./configure --host=x86_64-w64-mingw32 --prefix=${install_dir}/built_sdl
|
||||
remove_mwindows
|
||||
make
|
||||
make install
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function build_sdl_mixer {
|
||||
curl -O https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-${SDL2_mixer_version}.tar.gz
|
||||
# Do not extract the Xcode subdirectory because it contains symlinks.
|
||||
# They cannot be extracted on Windows because the files in the archive are in the wrong order so
|
||||
# the target of the link cannot be found at the time of the extraction.
|
||||
tar xf SDL2_mixer-${SDL2_mixer_version}.tar.gz --exclude=Xcode
|
||||
pushd SDL2_mixer-${SDL2_mixer_version}
|
||||
|
||||
./configure --host=x86_64-w64-mingw32 --disable-sdltest --with-sdl-prefix=${install_dir}/built_sdl --prefix=${install_dir}/built_sdl_mixer
|
||||
|
||||
remove_mwindows
|
||||
make
|
||||
make install
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function build_glew {
|
||||
curl -O https://netcologne.dl.sourceforge.net/project/glew/glew/${GLEW_version}/glew-${GLEW_version}.tgz
|
||||
tar xvf glew-${GLEW_version}.tgz
|
||||
mv glew-${GLEW_version}/ built_glew/
|
||||
pushd built_glew
|
||||
mingw32-make glew.lib
|
||||
popd
|
||||
}
|
||||
|
||||
function build_fluidsynth {
|
||||
git clone https://github.com/EtherTyper/fluidsynth-lite.git
|
||||
pushd fluidsynth-lite
|
||||
sed -i 's/DLL"\ off/DLL"\ on/' CMakeLists.txt
|
||||
# if building fluidsynth fails, move on without it
|
||||
set +e
|
||||
cmake -G "${CMAKE_target}" .
|
||||
cmake --build .
|
||||
|
||||
# download a soundfont that's close to the Windows default everyone knows
|
||||
curl -o music.sf2 http://rancid.kapsi.fi/windows.sf2
|
||||
set -e
|
||||
popd
|
||||
}
|
||||
|
||||
## Actual building starts here
|
||||
|
||||
if [ -d ./build_ext/ ]; then
|
||||
echo A directory named build_ext already exists.
|
||||
echo Please remove it if you want to recompile.
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v cmake)" ]; then
|
||||
echo CMake is needed to install Shockolate.
|
||||
echo Please download CMake from https://cmake.org/download/,
|
||||
echo install it and try again in a new Git Bash window.
|
||||
exit
|
||||
fi
|
||||
|
||||
rm -rf CMakeFiles/
|
||||
rm -rf CMakeCache.txt
|
||||
|
||||
cp windows/make.exe /usr/bin/
|
||||
|
||||
if [ ! -d ./res/ ]; then
|
||||
mkdir ./res/
|
||||
fi
|
||||
|
||||
mkdir ./build_ext/
|
||||
cd ./build_ext/
|
||||
install_dir=`pwd -W`
|
||||
|
||||
build_sdl
|
||||
build_sdl_mixer
|
||||
build_glew
|
||||
build_fluidsynth
|
||||
|
||||
|
||||
# Back to the root directory, copy required DLL files for the executable
|
||||
cd ..
|
||||
cp build_ext/built_sdl/bin/SDL*.dll .
|
||||
cp build_ext/built_sdl_mixer/bin/SDL*.dll .
|
||||
cp build_ext/built_glew/lib/*.dll .
|
||||
cp build_ext/fluidsynth-lite/src/*.dll .
|
||||
|
||||
# move the soundfont to the correct place if we successfully built fluidsynth
|
||||
mv build_ext/fluidsynth-lite/*.sf2 ./res
|
||||
|
||||
# Set up build.bat
|
||||
if [[ -z "${APPVEYOR}" ]]; then
|
||||
echo "Normal build"
|
||||
echo "@echo off
|
||||
cmake -G \"${CMAKE_target}\" .
|
||||
mingw32-make systemshock" >build.bat
|
||||
else
|
||||
echo "Appveyor"
|
||||
echo "cmake -G \"${CMAKE_target}\" .
|
||||
make systemshock" >build.bat
|
||||
fi
|
||||
|
||||
echo "Our work here is done. Run BUILD.BAT in a Windows shell to build the actual source."
|
||||
@@ -0,0 +1,107 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SDL_version=2.0.10
|
||||
SDL2_mixer_version=2.0.4
|
||||
GLEW_version=2.1.0
|
||||
CMAKE_target=Unix\ Makefiles
|
||||
|
||||
# Removing the mwindows linker option lets us get console output
|
||||
function remove_mwindows {
|
||||
sed -i -e "s/ \-mwindows//g" Makefile
|
||||
}
|
||||
|
||||
function build_sdl {
|
||||
curl -O https://www.libsdl.org/release/SDL2-devel-${SDL_version}-mingw.tar.gz
|
||||
tar xvf SDL2-devel-${SDL_version}-mingw.tar.gz
|
||||
cp -r SDL2-${SDL_version}/x86_64-w64-mingw32/ built_sdl/
|
||||
}
|
||||
|
||||
function build_sdl_mixer {
|
||||
curl -O https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-${SDL2_mixer_version}-mingw.tar.gz
|
||||
tar xf SDL2_mixer-devel-${SDL2_mixer_version}-mingw.tar.gz --exclude=Xcode
|
||||
cp -r SDL2_mixer-${SDL2_mixer_version}/x86_64-w64-mingw32/ built_sdl_mixer/
|
||||
}
|
||||
|
||||
function build_glew {
|
||||
curl -O https://netcologne.dl.sourceforge.net/project/glew/glew/${GLEW_version}/glew-${GLEW_version}.tgz
|
||||
tar xvf glew-${GLEW_version}.tgz
|
||||
mv glew-${GLEW_version}/ built_glew/
|
||||
pushd built_glew
|
||||
mingw32-make glew.lib
|
||||
popd
|
||||
}
|
||||
|
||||
function build_fluidsynth {
|
||||
git clone https://github.com/EtherTyper/fluidsynth-lite.git
|
||||
pushd fluidsynth-lite
|
||||
sed -i 's/DLL"\ off/DLL"\ on/' CMakeLists.txt
|
||||
# if building fluidsynth fails, move on without it
|
||||
set +e
|
||||
cmake -G "${CMAKE_target}" .
|
||||
cmake --build .
|
||||
|
||||
# download a soundfont that's close to the Windows default everyone knows
|
||||
curl -o music.sf2 http://rancid.kapsi.fi/windows.sf2
|
||||
set -e
|
||||
popd
|
||||
}
|
||||
|
||||
## Actual building starts here
|
||||
|
||||
if [ -d ./build_ext/ ]; then
|
||||
echo A directory named build_ext already exists.
|
||||
echo Please remove it if you want to recompile.
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v cmake)" ]; then
|
||||
echo CMake is needed to install Shockolate.
|
||||
echo Please download CMake from https://cmake.org/download/,
|
||||
echo install it and try again in a new Git Bash window.
|
||||
exit
|
||||
fi
|
||||
|
||||
rm -rf CMakeFiles/
|
||||
rm -rf CMakeCache.txt
|
||||
|
||||
cp windows/make.exe /usr/bin/
|
||||
|
||||
if [ ! -d ./res/ ]; then
|
||||
mkdir ./res/
|
||||
fi
|
||||
|
||||
mkdir ./build_ext/
|
||||
cd ./build_ext/
|
||||
install_dir=`pwd -W`
|
||||
|
||||
|
||||
build_sdl
|
||||
build_sdl_mixer
|
||||
build_glew
|
||||
build_fluidsynth
|
||||
|
||||
|
||||
# Back to the root directory, copy required DLL files for the executable
|
||||
cd ..
|
||||
cp build_ext/built_sdl/bin/SDL*.dll .
|
||||
cp build_ext/built_sdl_mixer/bin/SDL*.dll .
|
||||
cp build_ext/built_glew/lib/*.dll .
|
||||
cp build_ext/fluidsynth-lite/src/*.dll .
|
||||
|
||||
# move the soundfont to the correct place if we successfully built fluidsynth
|
||||
mv build_ext/fluidsynth-lite/*.sf2 ./res
|
||||
|
||||
# Set up build.bat
|
||||
if [[ -z "${APPVEYOR}" ]]; then
|
||||
echo "Normal build"
|
||||
echo "@echo off
|
||||
cmake -G \"${CMAKE_target}\" .
|
||||
mingw32-make systemshock" >build.bat
|
||||
else
|
||||
echo "Appveyor"
|
||||
echo "cmake -G \"${CMAKE_target}\" .
|
||||
make systemshock" >build.bat
|
||||
fi
|
||||
|
||||
echo "Our work here is done. Run BUILD.BAT in a Windows shell to build the actual source."
|
||||
@@ -0,0 +1,3 @@
|
||||
# out-of-source build top-level folders.
|
||||
build/
|
||||
_build/
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
# This file is part of CMake-sanitizers.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013-2015 Matt Arsenault
|
||||
# 2015 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# project information
|
||||
#
|
||||
|
||||
# minimum required cmake version
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
# project name
|
||||
project("CMake-sanitizers")
|
||||
|
||||
|
||||
|
||||
#
|
||||
# cmake configuration
|
||||
#
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
|
||||
|
||||
#
|
||||
# add tests
|
||||
#
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c)
|
||||
2013 Matthew Arsenault
|
||||
2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
# sanitizers-cmake
|
||||
|
||||
[](https://github.com/arsenm/sanitizers-cmake/issues)
|
||||
[](LICENSE)
|
||||
|
||||
CMake module to enable sanitizers for binary targets.
|
||||
|
||||
|
||||
## Include into your project
|
||||
|
||||
To use [FindSanitizers.cmake](cmake/FindSanitizers.cmake), simply add this repository as git submodule into your own repository
|
||||
```Shell
|
||||
mkdir externals
|
||||
git submodule add git://github.com/arsenm/sanitizers-cmake.git externals/sanitizers-cmake
|
||||
```
|
||||
and adding ```externals/sanitizers-cmake/cmake``` to your ```CMAKE_MODULE_PATH```
|
||||
```CMake
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
|
||||
```
|
||||
|
||||
If you don't use git or dislike submodules you can copy the files in [cmake directory](cmake) into your repository. *Be careful and keep updates in mind!*
|
||||
|
||||
Now you can simply run ```find_package``` in your CMake files:
|
||||
```CMake
|
||||
find_package(Sanitizers)
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
You can enable the sanitizers with ``SANITIZE_ADDRESS``, ``SANITIZE_MEMORY``, ``SANITIZE_THREAD`` or ``SANITIZE_UNDEFINED`` options in your CMake configuration. You can do this by passing e.g. ``-DSANITIZE_ADDRESS=On`` on your command line or with your graphical interface.
|
||||
|
||||
If sanitizers are supported by your compiler, the specified targets will be build with sanitizer support. If your compiler has no sanitizing capabilities (I asume intel compiler doesn't) you'll get a warning but CMake will continue processing and sanitizing will simply just be ignored.
|
||||
|
||||
#### Compiler issues
|
||||
|
||||
Different compilers may be using different implementations for sanitizers. If you'll try to sanitize targets with C and Fortran code but don't use gcc & gfortran but clang & gfortran, this will cause linking problems. To avoid this, such problems will be detected and sanitizing will be disabled for these targets.
|
||||
|
||||
Even C only targets may cause problems in certain situations. Some problems have been seen with AddressSanitizer for preloading or dynamic linking. In such cases you may try the ``SANITIZE_LINK_STATIC`` to link sanitizers for gcc static.
|
||||
|
||||
|
||||
|
||||
## Build targets with sanitizer support
|
||||
|
||||
To enable sanitizer support you simply have to add ``add_sanitizers(<TARGET>)`` after defining your target. To provide a sanitizer blacklist file you can use the ``sanitizer_add_blacklist_file(<FILE>)`` function:
|
||||
```CMake
|
||||
find_package(Sanitizers)
|
||||
|
||||
sanitizer_add_blacklist_file("blacklist.txt")
|
||||
|
||||
add_executable(some_exe foo.c bar.c)
|
||||
add_sanitizers(some_exe)
|
||||
|
||||
add_library(some_lib foo.c bar.c)
|
||||
add_sanitizers(some_lib)
|
||||
```
|
||||
|
||||
## Run your application
|
||||
|
||||
The sanitizers check your program, while it's running. In some situations (e.g. LD_PRELOAD your target) it might be required to preload the used AddressSanitizer library first. In this case you may use the ``asan-wrapper`` script defined in ``ASan_WRAPPER`` variable to execute your application with ``${ASan_WRAPPER} myexe arg1 ...``.
|
||||
|
||||
|
||||
## Contribute
|
||||
|
||||
Anyone is welcome to contribute. Simply fork this repository, make your changes **in an own branch** and create a pull-request for your change. Please do only one change per pull-request.
|
||||
|
||||
You found a bug? Please fill out an [issue](https://github.com/arsenm/sanitizers-cmake/issues) and include any data to reproduce the bug.
|
||||
|
||||
|
||||
#### Contributors
|
||||
|
||||
* [Matt Arsenault](https://github.com/arsenm)
|
||||
* [Alexander Haase](https://github.com/alehaa)
|
||||
@@ -0,0 +1,59 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_ADDRESS "Enable AddressSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
# Clang 3.2+ use this version. The no-omit-frame-pointer option is optional.
|
||||
"-g -fsanitize=address -fno-omit-frame-pointer"
|
||||
"-g -fsanitize=address"
|
||||
|
||||
# Older deprecated flag for ASan
|
||||
"-g -faddress-sanitizer"
|
||||
)
|
||||
|
||||
|
||||
if (SANITIZE_ADDRESS AND (SANITIZE_THREAD OR SANITIZE_MEMORY))
|
||||
message(FATAL_ERROR "AddressSanitizer is not compatible with "
|
||||
"ThreadSanitizer or MemorySanitizer.")
|
||||
endif ()
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_ADDRESS)
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "AddressSanitizer"
|
||||
"ASan")
|
||||
|
||||
find_program(ASan_WRAPPER "asan-wrapper" PATHS ${CMAKE_MODULE_PATH})
|
||||
mark_as_advanced(ASan_WRAPPER)
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_address TARGET)
|
||||
if (NOT SANITIZE_ADDRESS)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "AddressSanitizer" "ASan")
|
||||
endfunction ()
|
||||
@@ -0,0 +1,57 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_MEMORY "Enable MemorySanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=memory"
|
||||
)
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_MEMORY)
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
|
||||
"MemorySanitizer is supported for Linux systems only.")
|
||||
set(SANITIZE_MEMORY Off CACHE BOOL
|
||||
"Enable MemorySanitizer for sanitized targets." FORCE)
|
||||
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
|
||||
"MemorySanitizer is supported for 64bit systems only.")
|
||||
set(SANITIZE_MEMORY Off CACHE BOOL
|
||||
"Enable MemorySanitizer for sanitized targets." FORCE)
|
||||
else ()
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer"
|
||||
"MSan")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_memory TARGET)
|
||||
if (NOT SANITIZE_MEMORY)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "MemorySanitizer" "MSan")
|
||||
endfunction ()
|
||||
@@ -0,0 +1,87 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# If any of the used compiler is a GNU compiler, add a second option to static
|
||||
# link against the sanitizers.
|
||||
option(SANITIZE_LINK_STATIC "Try to link static against sanitizers." Off)
|
||||
|
||||
|
||||
|
||||
|
||||
set(FIND_QUIETLY_FLAG "")
|
||||
if (DEFINED Sanitizers_FIND_QUIETLY)
|
||||
set(FIND_QUIETLY_FLAG "QUIET")
|
||||
endif ()
|
||||
|
||||
find_package(ASan ${FIND_QUIETLY_FLAG})
|
||||
find_package(TSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(MSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(UBSan ${FIND_QUIETLY_FLAG})
|
||||
|
||||
|
||||
|
||||
|
||||
function(sanitizer_add_blacklist_file FILE)
|
||||
if(NOT IS_ABSOLUTE ${FILE})
|
||||
set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
|
||||
endif()
|
||||
get_filename_component(FILE "${FILE}" REALPATH)
|
||||
|
||||
sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}"
|
||||
"SanitizerBlacklist" "SanBlist")
|
||||
endfunction()
|
||||
|
||||
function(add_sanitizers ...)
|
||||
# If no sanitizer is enabled, return immediately.
|
||||
if (NOT (SANITIZE_ADDRESS OR SANITIZE_MEMORY OR SANITIZE_THREAD OR
|
||||
SANITIZE_UNDEFINED))
|
||||
return()
|
||||
endif ()
|
||||
|
||||
foreach (TARGET ${ARGV})
|
||||
# Check if this target will be compiled by exactly one compiler. Other-
|
||||
# wise sanitizers can't be used and a warning should be printed once.
|
||||
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
|
||||
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
||||
if (NUM_COMPILERS GREATER 1)
|
||||
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
|
||||
"because it will be compiled by incompatible compilers. "
|
||||
"Target will be compiled without sanitizers.")
|
||||
return()
|
||||
|
||||
# If the target is compiled by no known compiler, ignore it.
|
||||
elseif (NUM_COMPILERS EQUAL 0)
|
||||
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
|
||||
"because it uses an unknown compiler. Target will be "
|
||||
"compiled without sanitizers.")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
# Add sanitizers for target.
|
||||
add_sanitize_address(${TARGET})
|
||||
add_sanitize_thread(${TARGET})
|
||||
add_sanitize_memory(${TARGET})
|
||||
add_sanitize_undefined(${TARGET})
|
||||
endforeach ()
|
||||
endfunction(add_sanitizers)
|
||||
@@ -0,0 +1,65 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_THREAD "Enable ThreadSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=thread"
|
||||
)
|
||||
|
||||
|
||||
# ThreadSanitizer is not compatible with MemorySanitizer.
|
||||
if (SANITIZE_THREAD AND SANITIZE_MEMORY)
|
||||
message(FATAL_ERROR "ThreadSanitizer is not compatible with "
|
||||
"MemorySanitizer.")
|
||||
endif ()
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_THREAD)
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND
|
||||
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
|
||||
"ThreadSanitizer is supported for Linux systems and macOS only.")
|
||||
set(SANITIZE_THREAD Off CACHE BOOL
|
||||
"Enable ThreadSanitizer for sanitized targets." FORCE)
|
||||
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
|
||||
"ThreadSanitizer is supported for 64bit systems only.")
|
||||
set(SANITIZE_THREAD Off CACHE BOOL
|
||||
"Enable ThreadSanitizer for sanitized targets." FORCE)
|
||||
else ()
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "ThreadSanitizer"
|
||||
"TSan")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_thread TARGET)
|
||||
if (NOT SANITIZE_THREAD)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "ThreadSanitizer" "TSan")
|
||||
endfunction ()
|
||||
@@ -0,0 +1,46 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_UNDEFINED
|
||||
"Enable UndefinedBehaviorSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=undefined"
|
||||
)
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_UNDEFINED)
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}"
|
||||
"UndefinedBehaviorSanitizer" "UBSan")
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_undefined TARGET)
|
||||
if (NOT SANITIZE_UNDEFINED)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "UndefinedBehaviorSanitizer" "UBSan")
|
||||
endfunction ()
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# This script is a wrapper for AddressSanitizer. In some special cases you need
|
||||
# to preload AddressSanitizer to avoid error messages - e.g. if you're
|
||||
# preloading another library to your application. At the moment this script will
|
||||
# only do something, if we're running on a Linux platform. OSX might not be
|
||||
# affected.
|
||||
|
||||
|
||||
# Exit immediately, if platform is not Linux.
|
||||
if [ "$(uname)" != "Linux" ]
|
||||
then
|
||||
exec $@
|
||||
fi
|
||||
|
||||
|
||||
# Get the used libasan of the application ($1). If a libasan was found, it will
|
||||
# be prepended to LD_PRELOAD.
|
||||
libasan=$(ldd $1 | grep libasan | sed "s/^[[:space:]]//" | cut -d' ' -f1)
|
||||
if [ -n "$libasan" ]
|
||||
then
|
||||
if [ -n "$LD_PRELOAD" ]
|
||||
then
|
||||
export LD_PRELOAD="$libasan:$LD_PRELOAD"
|
||||
else
|
||||
export LD_PRELOAD="$libasan"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Execute the application.
|
||||
exec $@
|
||||
@@ -0,0 +1,170 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# Helper function to get the language of a source file.
|
||||
function (sanitizer_lang_of_source FILE RETURN_VAR)
|
||||
get_filename_component(FILE_EXT "${FILE}" EXT)
|
||||
string(TOLOWER "${FILE_EXT}" FILE_EXT)
|
||||
string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
|
||||
|
||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
foreach (LANG ${ENABLED_LANGUAGES})
|
||||
list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
|
||||
if (NOT ${TEMP} EQUAL -1)
|
||||
set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
|
||||
return()
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
set(${RETURN_VAR} "" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to get compilers used by a target.
|
||||
function (sanitizer_target_compilers TARGET RETURN_VAR)
|
||||
# Check if all sources for target use the same compiler. If a target uses
|
||||
# e.g. C and Fortran mixed and uses different compilers (e.g. clang and
|
||||
# gfortran) this can trigger huge problems, because different compilers may
|
||||
# use different implementations for sanitizers.
|
||||
set(BUFFER "")
|
||||
get_target_property(TSOURCES ${TARGET} SOURCES)
|
||||
foreach (FILE ${TSOURCES})
|
||||
# If expression was found, FILE is a generator-expression for an object
|
||||
# library. Object libraries will be ignored.
|
||||
string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
|
||||
if ("${_file}" STREQUAL "")
|
||||
sanitizer_lang_of_source(${FILE} LANG)
|
||||
if (LANG)
|
||||
list(APPEND BUFFER ${CMAKE_${LANG}_COMPILER_ID})
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
list(REMOVE_DUPLICATES BUFFER)
|
||||
set(${RETURN_VAR} "${BUFFER}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to check compiler flags for language compiler.
|
||||
function (sanitizer_check_compiler_flag FLAG LANG VARIABLE)
|
||||
if (${LANG} STREQUAL "C")
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
|
||||
elseif (${LANG} STREQUAL "CXX")
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
|
||||
elseif (${LANG} STREQUAL "Fortran")
|
||||
# CheckFortranCompilerFlag was introduced in CMake 3.x. To be compatible
|
||||
# with older Cmake versions, we will check if this module is present
|
||||
# before we use it. Otherwise we will define Fortran coverage support as
|
||||
# not available.
|
||||
include(CheckFortranCompilerFlag OPTIONAL RESULT_VARIABLE INCLUDED)
|
||||
if (INCLUDED)
|
||||
check_fortran_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
elseif (NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Performing Test ${VARIABLE}")
|
||||
message(STATUS "Performing Test ${VARIABLE}"
|
||||
" - Failed (Check not supported)")
|
||||
endif ()
|
||||
endif()
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to test compiler flags.
|
||||
function (sanitizer_check_compiler_flags FLAG_CANDIDATES NAME PREFIX)
|
||||
set(CMAKE_REQUIRED_QUIET ${${PREFIX}_FIND_QUIETLY})
|
||||
|
||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
foreach (LANG ${ENABLED_LANGUAGES})
|
||||
# Sanitizer flags are not dependend on language, but the used compiler.
|
||||
# So instead of searching flags foreach language, search flags foreach
|
||||
# compiler used.
|
||||
set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
||||
if (NOT DEFINED ${PREFIX}_${COMPILER}_FLAGS)
|
||||
foreach (FLAG ${FLAG_CANDIDATES})
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Try ${COMPILER} ${NAME} flag = [${FLAG}]")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset(${PREFIX}_FLAG_DETECTED CACHE)
|
||||
sanitizer_check_compiler_flag("${FLAG}" ${LANG}
|
||||
${PREFIX}_FLAG_DETECTED)
|
||||
|
||||
if (${PREFIX}_FLAG_DETECTED)
|
||||
# If compiler is a GNU compiler, search for static flag, if
|
||||
# SANITIZE_LINK_STATIC is enabled.
|
||||
if (SANITIZE_LINK_STATIC AND (${COMPILER} STREQUAL "GNU"))
|
||||
string(TOLOWER ${PREFIX} PREFIX_lower)
|
||||
sanitizer_check_compiler_flag(
|
||||
"-static-lib${PREFIX_lower}" ${LANG}
|
||||
${PREFIX}_STATIC_FLAG_DETECTED)
|
||||
|
||||
if (${PREFIX}_STATIC_FLAG_DETECTED)
|
||||
set(FLAG "-static-lib${PREFIX_lower} ${FLAG}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(${PREFIX}_${COMPILER}_FLAGS "${FLAG}" CACHE STRING
|
||||
"${NAME} flags for ${COMPILER} compiler.")
|
||||
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
|
||||
break()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
if (NOT ${PREFIX}_FLAG_DETECTED)
|
||||
set(${PREFIX}_${COMPILER}_FLAGS "" CACHE STRING
|
||||
"${NAME} flags for ${COMPILER} compiler.")
|
||||
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
|
||||
|
||||
message(WARNING "${NAME} is not available for ${COMPILER} "
|
||||
"compiler. Targets using this compiler will be "
|
||||
"compiled without ${NAME}.")
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper to assign sanitizer flags for TARGET.
|
||||
function (sanitizer_add_flags TARGET NAME PREFIX)
|
||||
# Get list of compilers used by target and check, if sanitizer is available
|
||||
# for this target. Other compiler checks like check for conflicting
|
||||
# compilers will be done in add_sanitizers function.
|
||||
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
|
||||
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
||||
if ("${${PREFIX}_${TARGET_COMPILER}_FLAGS}" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Set compile- and link-flags for target.
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY COMPILE_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY COMPILE_FLAGS " ${SanBlist_${TARGET_COMPILER}_FLAGS}")
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY LINK_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
|
||||
endfunction ()
|
||||
@@ -0,0 +1,3 @@
|
||||
# out-of-source build top-level folders.
|
||||
build/
|
||||
_build/
|
||||
@@ -0,0 +1,51 @@
|
||||
# This file is part of CMake-sanitizers.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013-2015 Matt Arsenault
|
||||
# 2015 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# project information
|
||||
#
|
||||
|
||||
# minimum required cmake version
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
# project name
|
||||
project("CMake-sanitizers")
|
||||
|
||||
|
||||
|
||||
#
|
||||
# cmake configuration
|
||||
#
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
|
||||
|
||||
#
|
||||
# add tests
|
||||
#
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c)
|
||||
2013 Matthew Arsenault
|
||||
2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,73 @@
|
||||
# sanitizers-cmake
|
||||
|
||||
[](https://github.com/arsenm/sanitizers-cmake/issues)
|
||||
[](LICENSE)
|
||||
|
||||
CMake module to enable sanitizers for binary targets.
|
||||
|
||||
|
||||
## Include into your project
|
||||
|
||||
To use [FindSanitizers.cmake](cmake/FindSanitizers.cmake), simply add this repository as git submodule into your own repository
|
||||
```Shell
|
||||
mkdir externals
|
||||
git submodule add git://github.com/arsenm/sanitizers-cmake.git externals/sanitizers-cmake
|
||||
```
|
||||
and adding ```externals/sanitizers-cmake/cmake``` to your ```CMAKE_MODULE_PATH```
|
||||
```CMake
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
|
||||
```
|
||||
|
||||
If you don't use git or dislike submodules you can copy the files in [cmake directory](cmake) into your repository. *Be careful and keep updates in mind!*
|
||||
|
||||
Now you can simply run ```find_package``` in your CMake files:
|
||||
```CMake
|
||||
find_package(Sanitizers)
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
You can enable the sanitizers with ``SANITIZE_ADDRESS``, ``SANITIZE_MEMORY``, ``SANITIZE_THREAD`` or ``SANITIZE_UNDEFINED`` options in your CMake configuration. You can do this by passing e.g. ``-DSANITIZE_ADDRESS=On`` on your command line or with your graphical interface.
|
||||
|
||||
If sanitizers are supported by your compiler, the specified targets will be build with sanitizer support. If your compiler has no sanitizing capabilities (I asume intel compiler doesn't) you'll get a warning but CMake will continue processing and sanitizing will simply just be ignored.
|
||||
|
||||
#### Compiler issues
|
||||
|
||||
Different compilers may be using different implementations for sanitizers. If you'll try to sanitize targets with C and Fortran code but don't use gcc & gfortran but clang & gfortran, this will cause linking problems. To avoid this, such problems will be detected and sanitizing will be disabled for these targets.
|
||||
|
||||
Even C only targets may cause problems in certain situations. Some problems have been seen with AddressSanitizer for preloading or dynamic linking. In such cases you may try the ``SANITIZE_LINK_STATIC`` to link sanitizers for gcc static.
|
||||
|
||||
|
||||
|
||||
## Build targets with sanitizer support
|
||||
|
||||
To enable sanitizer support you simply have to add ``add_sanitizers(<TARGET>)`` after defining your target. To provide a sanitizer blacklist file you can use the ``sanitizer_add_blacklist_file(<FILE>)`` function:
|
||||
```CMake
|
||||
find_package(Sanitizers)
|
||||
|
||||
sanitizer_add_blacklist_file("blacklist.txt")
|
||||
|
||||
add_executable(some_exe foo.c bar.c)
|
||||
add_sanitizers(some_exe)
|
||||
|
||||
add_library(some_lib foo.c bar.c)
|
||||
add_sanitizers(some_lib)
|
||||
```
|
||||
|
||||
## Run your application
|
||||
|
||||
The sanitizers check your program, while it's running. In some situations (e.g. LD_PRELOAD your target) it might be required to preload the used AddressSanitizer library first. In this case you may use the ``asan-wrapper`` script defined in ``ASan_WRAPPER`` variable to execute your application with ``${ASan_WRAPPER} myexe arg1 ...``.
|
||||
|
||||
|
||||
## Contribute
|
||||
|
||||
Anyone is welcome to contribute. Simply fork this repository, make your changes **in an own branch** and create a pull-request for your change. Please do only one change per pull-request.
|
||||
|
||||
You found a bug? Please fill out an [issue](https://github.com/arsenm/sanitizers-cmake/issues) and include any data to reproduce the bug.
|
||||
|
||||
|
||||
#### Contributors
|
||||
|
||||
* [Matt Arsenault](https://github.com/arsenm)
|
||||
* [Alexander Haase](https://github.com/alehaa)
|
||||
@@ -0,0 +1,59 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_ADDRESS "Enable AddressSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
# Clang 3.2+ use this version. The no-omit-frame-pointer option is optional.
|
||||
"-g -fsanitize=address -fno-omit-frame-pointer"
|
||||
"-g -fsanitize=address"
|
||||
|
||||
# Older deprecated flag for ASan
|
||||
"-g -faddress-sanitizer"
|
||||
)
|
||||
|
||||
|
||||
if (SANITIZE_ADDRESS AND (SANITIZE_THREAD OR SANITIZE_MEMORY))
|
||||
message(FATAL_ERROR "AddressSanitizer is not compatible with "
|
||||
"ThreadSanitizer or MemorySanitizer.")
|
||||
endif ()
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_ADDRESS)
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "AddressSanitizer"
|
||||
"ASan")
|
||||
|
||||
find_program(ASan_WRAPPER "asan-wrapper" PATHS ${CMAKE_MODULE_PATH})
|
||||
mark_as_advanced(ASan_WRAPPER)
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_address TARGET)
|
||||
if (NOT SANITIZE_ADDRESS)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "AddressSanitizer" "ASan")
|
||||
endfunction ()
|
||||
@@ -0,0 +1,57 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_MEMORY "Enable MemorySanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=memory"
|
||||
)
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_MEMORY)
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
|
||||
"MemorySanitizer is supported for Linux systems only.")
|
||||
set(SANITIZE_MEMORY Off CACHE BOOL
|
||||
"Enable MemorySanitizer for sanitized targets." FORCE)
|
||||
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
|
||||
"MemorySanitizer is supported for 64bit systems only.")
|
||||
set(SANITIZE_MEMORY Off CACHE BOOL
|
||||
"Enable MemorySanitizer for sanitized targets." FORCE)
|
||||
else ()
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer"
|
||||
"MSan")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_memory TARGET)
|
||||
if (NOT SANITIZE_MEMORY)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "MemorySanitizer" "MSan")
|
||||
endfunction ()
|
||||
@@ -0,0 +1,87 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# If any of the used compiler is a GNU compiler, add a second option to static
|
||||
# link against the sanitizers.
|
||||
option(SANITIZE_LINK_STATIC "Try to link static against sanitizers." Off)
|
||||
|
||||
|
||||
|
||||
|
||||
set(FIND_QUIETLY_FLAG "")
|
||||
if (DEFINED Sanitizers_FIND_QUIETLY)
|
||||
set(FIND_QUIETLY_FLAG "QUIET")
|
||||
endif ()
|
||||
|
||||
find_package(ASan ${FIND_QUIETLY_FLAG})
|
||||
find_package(TSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(MSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(UBSan ${FIND_QUIETLY_FLAG})
|
||||
|
||||
|
||||
|
||||
|
||||
function(sanitizer_add_blacklist_file FILE)
|
||||
if(NOT IS_ABSOLUTE ${FILE})
|
||||
set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
|
||||
endif()
|
||||
get_filename_component(FILE "${FILE}" REALPATH)
|
||||
|
||||
sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}"
|
||||
"SanitizerBlacklist" "SanBlist")
|
||||
endfunction()
|
||||
|
||||
function(add_sanitizers ...)
|
||||
# If no sanitizer is enabled, return immediately.
|
||||
if (NOT (SANITIZE_ADDRESS OR SANITIZE_MEMORY OR SANITIZE_THREAD OR
|
||||
SANITIZE_UNDEFINED))
|
||||
return()
|
||||
endif ()
|
||||
|
||||
foreach (TARGET ${ARGV})
|
||||
# Check if this target will be compiled by exactly one compiler. Other-
|
||||
# wise sanitizers can't be used and a warning should be printed once.
|
||||
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
|
||||
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
||||
if (NUM_COMPILERS GREATER 1)
|
||||
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
|
||||
"because it will be compiled by incompatible compilers. "
|
||||
"Target will be compiled without sanitizers.")
|
||||
return()
|
||||
|
||||
# If the target is compiled by no known compiler, ignore it.
|
||||
elseif (NUM_COMPILERS EQUAL 0)
|
||||
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
|
||||
"because it uses an unknown compiler. Target will be "
|
||||
"compiled without sanitizers.")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
# Add sanitizers for target.
|
||||
add_sanitize_address(${TARGET})
|
||||
add_sanitize_thread(${TARGET})
|
||||
add_sanitize_memory(${TARGET})
|
||||
add_sanitize_undefined(${TARGET})
|
||||
endforeach ()
|
||||
endfunction(add_sanitizers)
|
||||
@@ -0,0 +1,65 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_THREAD "Enable ThreadSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=thread"
|
||||
)
|
||||
|
||||
|
||||
# ThreadSanitizer is not compatible with MemorySanitizer.
|
||||
if (SANITIZE_THREAD AND SANITIZE_MEMORY)
|
||||
message(FATAL_ERROR "ThreadSanitizer is not compatible with "
|
||||
"MemorySanitizer.")
|
||||
endif ()
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_THREAD)
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND
|
||||
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
|
||||
"ThreadSanitizer is supported for Linux systems and macOS only.")
|
||||
set(SANITIZE_THREAD Off CACHE BOOL
|
||||
"Enable ThreadSanitizer for sanitized targets." FORCE)
|
||||
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
|
||||
"ThreadSanitizer is supported for 64bit systems only.")
|
||||
set(SANITIZE_THREAD Off CACHE BOOL
|
||||
"Enable ThreadSanitizer for sanitized targets." FORCE)
|
||||
else ()
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "ThreadSanitizer"
|
||||
"TSan")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_thread TARGET)
|
||||
if (NOT SANITIZE_THREAD)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "ThreadSanitizer" "TSan")
|
||||
endfunction ()
|
||||
@@ -0,0 +1,46 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_UNDEFINED
|
||||
"Enable UndefinedBehaviorSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=undefined"
|
||||
)
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_UNDEFINED)
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}"
|
||||
"UndefinedBehaviorSanitizer" "UBSan")
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_undefined TARGET)
|
||||
if (NOT SANITIZE_UNDEFINED)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "UndefinedBehaviorSanitizer" "UBSan")
|
||||
endfunction ()
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# This script is a wrapper for AddressSanitizer. In some special cases you need
|
||||
# to preload AddressSanitizer to avoid error messages - e.g. if you're
|
||||
# preloading another library to your application. At the moment this script will
|
||||
# only do something, if we're running on a Linux platform. OSX might not be
|
||||
# affected.
|
||||
|
||||
|
||||
# Exit immediately, if platform is not Linux.
|
||||
if [ "$(uname)" != "Linux" ]
|
||||
then
|
||||
exec $@
|
||||
fi
|
||||
|
||||
|
||||
# Get the used libasan of the application ($1). If a libasan was found, it will
|
||||
# be prepended to LD_PRELOAD.
|
||||
libasan=$(ldd $1 | grep libasan | sed "s/^[[:space:]]//" | cut -d' ' -f1)
|
||||
if [ -n "$libasan" ]
|
||||
then
|
||||
if [ -n "$LD_PRELOAD" ]
|
||||
then
|
||||
export LD_PRELOAD="$libasan:$LD_PRELOAD"
|
||||
else
|
||||
export LD_PRELOAD="$libasan"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Execute the application.
|
||||
exec $@
|
||||
@@ -0,0 +1,170 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# Helper function to get the language of a source file.
|
||||
function (sanitizer_lang_of_source FILE RETURN_VAR)
|
||||
get_filename_component(FILE_EXT "${FILE}" EXT)
|
||||
string(TOLOWER "${FILE_EXT}" FILE_EXT)
|
||||
string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
|
||||
|
||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
foreach (LANG ${ENABLED_LANGUAGES})
|
||||
list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
|
||||
if (NOT ${TEMP} EQUAL -1)
|
||||
set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
|
||||
return()
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
set(${RETURN_VAR} "" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to get compilers used by a target.
|
||||
function (sanitizer_target_compilers TARGET RETURN_VAR)
|
||||
# Check if all sources for target use the same compiler. If a target uses
|
||||
# e.g. C and Fortran mixed and uses different compilers (e.g. clang and
|
||||
# gfortran) this can trigger huge problems, because different compilers may
|
||||
# use different implementations for sanitizers.
|
||||
set(BUFFER "")
|
||||
get_target_property(TSOURCES ${TARGET} SOURCES)
|
||||
foreach (FILE ${TSOURCES})
|
||||
# If expression was found, FILE is a generator-expression for an object
|
||||
# library. Object libraries will be ignored.
|
||||
string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
|
||||
if ("${_file}" STREQUAL "")
|
||||
sanitizer_lang_of_source(${FILE} LANG)
|
||||
if (LANG)
|
||||
list(APPEND BUFFER ${CMAKE_${LANG}_COMPILER_ID})
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
list(REMOVE_DUPLICATES BUFFER)
|
||||
set(${RETURN_VAR} "${BUFFER}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to check compiler flags for language compiler.
|
||||
function (sanitizer_check_compiler_flag FLAG LANG VARIABLE)
|
||||
if (${LANG} STREQUAL "C")
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
|
||||
elseif (${LANG} STREQUAL "CXX")
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
|
||||
elseif (${LANG} STREQUAL "Fortran")
|
||||
# CheckFortranCompilerFlag was introduced in CMake 3.x. To be compatible
|
||||
# with older Cmake versions, we will check if this module is present
|
||||
# before we use it. Otherwise we will define Fortran coverage support as
|
||||
# not available.
|
||||
include(CheckFortranCompilerFlag OPTIONAL RESULT_VARIABLE INCLUDED)
|
||||
if (INCLUDED)
|
||||
check_fortran_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
elseif (NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Performing Test ${VARIABLE}")
|
||||
message(STATUS "Performing Test ${VARIABLE}"
|
||||
" - Failed (Check not supported)")
|
||||
endif ()
|
||||
endif()
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to test compiler flags.
|
||||
function (sanitizer_check_compiler_flags FLAG_CANDIDATES NAME PREFIX)
|
||||
set(CMAKE_REQUIRED_QUIET ${${PREFIX}_FIND_QUIETLY})
|
||||
|
||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
foreach (LANG ${ENABLED_LANGUAGES})
|
||||
# Sanitizer flags are not dependend on language, but the used compiler.
|
||||
# So instead of searching flags foreach language, search flags foreach
|
||||
# compiler used.
|
||||
set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
||||
if (NOT DEFINED ${PREFIX}_${COMPILER}_FLAGS)
|
||||
foreach (FLAG ${FLAG_CANDIDATES})
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Try ${COMPILER} ${NAME} flag = [${FLAG}]")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset(${PREFIX}_FLAG_DETECTED CACHE)
|
||||
sanitizer_check_compiler_flag("${FLAG}" ${LANG}
|
||||
${PREFIX}_FLAG_DETECTED)
|
||||
|
||||
if (${PREFIX}_FLAG_DETECTED)
|
||||
# If compiler is a GNU compiler, search for static flag, if
|
||||
# SANITIZE_LINK_STATIC is enabled.
|
||||
if (SANITIZE_LINK_STATIC AND (${COMPILER} STREQUAL "GNU"))
|
||||
string(TOLOWER ${PREFIX} PREFIX_lower)
|
||||
sanitizer_check_compiler_flag(
|
||||
"-static-lib${PREFIX_lower}" ${LANG}
|
||||
${PREFIX}_STATIC_FLAG_DETECTED)
|
||||
|
||||
if (${PREFIX}_STATIC_FLAG_DETECTED)
|
||||
set(FLAG "-static-lib${PREFIX_lower} ${FLAG}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(${PREFIX}_${COMPILER}_FLAGS "${FLAG}" CACHE STRING
|
||||
"${NAME} flags for ${COMPILER} compiler.")
|
||||
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
|
||||
break()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
if (NOT ${PREFIX}_FLAG_DETECTED)
|
||||
set(${PREFIX}_${COMPILER}_FLAGS "" CACHE STRING
|
||||
"${NAME} flags for ${COMPILER} compiler.")
|
||||
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
|
||||
|
||||
message(WARNING "${NAME} is not available for ${COMPILER} "
|
||||
"compiler. Targets using this compiler will be "
|
||||
"compiled without ${NAME}.")
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper to assign sanitizer flags for TARGET.
|
||||
function (sanitizer_add_flags TARGET NAME PREFIX)
|
||||
# Get list of compilers used by target and check, if sanitizer is available
|
||||
# for this target. Other compiler checks like check for conflicting
|
||||
# compilers will be done in add_sanitizers function.
|
||||
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
|
||||
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
||||
if ("${${PREFIX}_${TARGET_COMPILER}_FLAGS}" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Set compile- and link-flags for target.
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY COMPILE_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY COMPILE_FLAGS " ${SanBlist_${TARGET_COMPILER}_FLAGS}")
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY LINK_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
|
||||
endfunction ()
|
||||
@@ -0,0 +1,52 @@
|
||||
# This file is part of CMake-sanitizers.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013-2015 Matt Arsenault
|
||||
# 2015 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
|
||||
# Function to add testcases.
|
||||
function(add_testcase TESTNAME SOURCEFILES)
|
||||
# remove ${TESTNAME} from ${ARGV} to use ${ARGV} as ${SOURCEFILES}
|
||||
list(REMOVE_AT ARGV 0)
|
||||
|
||||
# add a new executable
|
||||
add_executable(${TESTNAME} ${ARGV})
|
||||
add_sanitizers(${TESTNAME})
|
||||
|
||||
# add a testcase for executable
|
||||
add_test(${TESTNAME} ${TESTNAME})
|
||||
endfunction(add_testcase)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# search for sanitizers
|
||||
#
|
||||
find_package(Sanitizers)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# add testcases
|
||||
#
|
||||
add_testcase("asan_test_cpp" asan_test.cpp)
|
||||
@@ -0,0 +1,39 @@
|
||||
/* This file is part of CMake-sanitizers.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
* Copyright (c)
|
||||
* 2013-2015 Matt Arsenault
|
||||
* 2015 RWTH Aachen University, Federal Republic of Germany
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// Allocate a new array and delete it.
|
||||
int *array = new int[argc];
|
||||
delete[] array;
|
||||
|
||||
/* Access element of the deleted array. This will cause an memory error with
|
||||
* address sanitizer.
|
||||
*/
|
||||
return array[argc];
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
# This file is part of CMake-sanitizers.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013-2015 Matt Arsenault
|
||||
# 2015 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
|
||||
# Function to add testcases.
|
||||
function(add_testcase TESTNAME SOURCEFILES)
|
||||
# remove ${TESTNAME} from ${ARGV} to use ${ARGV} as ${SOURCEFILES}
|
||||
list(REMOVE_AT ARGV 0)
|
||||
|
||||
# add a new executable
|
||||
add_executable(${TESTNAME} ${ARGV})
|
||||
add_sanitizers(${TESTNAME})
|
||||
|
||||
# add a testcase for executable
|
||||
add_test(${TESTNAME} ${TESTNAME})
|
||||
endfunction(add_testcase)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# search for sanitizers
|
||||
#
|
||||
find_package(Sanitizers)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# add testcases
|
||||
#
|
||||
add_testcase("asan_test_cpp" asan_test.cpp)
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/* This file is part of CMake-sanitizers.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
* Copyright (c)
|
||||
* 2013-2015 Matt Arsenault
|
||||
* 2015 RWTH Aachen University, Federal Republic of Germany
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// Allocate a new array and delete it.
|
||||
int *array = new int[argc];
|
||||
delete[] array;
|
||||
|
||||
/* Access element of the deleted array. This will cause an memory error with
|
||||
* address sanitizer.
|
||||
*/
|
||||
return array[argc];
|
||||
}
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Setting up
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SDL_version=2.0.9
|
||||
SDL2_mixer_version=2.0.4
|
||||
|
||||
function build_sdl {
|
||||
curl -O https://www.libsdl.org/release/SDL2-${SDL_version}.tar.gz
|
||||
tar xf SDL2-${SDL_version}.tar.gz
|
||||
pushd SDL2-${SDL_version}
|
||||
|
||||
./configure "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" --prefix=${install_dir}/built_sdl
|
||||
make -j2
|
||||
make install
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function build_sdl_mixer {
|
||||
curl -O https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-${SDL2_mixer_version}.tar.gz
|
||||
tar xf SDL2_mixer-${SDL2_mixer_version}.tar.gz
|
||||
pushd SDL2_mixer-${SDL2_mixer_version}
|
||||
|
||||
export SDL2_CONFIG="${install_dir}/built_sdl/bin/sdl2-config"
|
||||
./configure "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" --prefix=${install_dir}/built_sdl_mixer
|
||||
make -j2
|
||||
make install
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function build_fluidsynth {
|
||||
git clone https://github.com/EtherTyper/fluidsynth-lite.git
|
||||
pushd fluidsynth-lite
|
||||
|
||||
# force compilation of dynamic library
|
||||
sed -i'' -e 's/DLL\"\ off/DLL\"\ on/' CMakeLists.txt
|
||||
|
||||
# force 32bit compilation
|
||||
sed -i'' -e 's/\${GNUCC_WARNING_FLAGS}/-m32 \${GNUCC_WARNING_FLAGS}/' CMakeLists.txt
|
||||
|
||||
# if building fluidsynth fails, move on without it
|
||||
set +e
|
||||
cmake .
|
||||
cmake --build .
|
||||
|
||||
# download a soundfont that's close to the Windows default everyone knows
|
||||
curl -o music.sf2 http://rancid.kapsi.fi/windows.sf2
|
||||
set -e
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
# Actual script starts here
|
||||
|
||||
if [ -d ./build_ext/ ]; then
|
||||
echo A directory named build_ext already exists.
|
||||
echo Please remove it if you want to recompile.
|
||||
exit
|
||||
fi
|
||||
|
||||
mkdir ./build_ext/
|
||||
cd ./build_ext/
|
||||
|
||||
install_dir=$(pwd)
|
||||
|
||||
build_fluidsynth
|
||||
build_sdl
|
||||
build_sdl_mixer
|
||||
|
||||
cd ..
|
||||
|
||||
mkdir -p ./res/
|
||||
|
||||
# move the soundfont to the correct place if we successfully built fluidsynth
|
||||
for i in build_ext/fluidsynth-lite/*.sf2; do [ -f "$i" ] || break; mv $i res/; done;
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Setting up
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SDL_version=2.0.9
|
||||
SDL2_mixer_version=2.0.4
|
||||
|
||||
function build_sdl {
|
||||
curl -O https://www.libsdl.org/release/SDL2-${SDL_version}.tar.gz
|
||||
tar xf SDL2-${SDL_version}.tar.gz
|
||||
pushd SDL2-${SDL_version}
|
||||
|
||||
./configure --prefix=${install_dir}/built_sdl
|
||||
make -j2
|
||||
make install
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function build_sdl_mixer {
|
||||
curl -O https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-${SDL2_mixer_version}.tar.gz
|
||||
tar xf SDL2_mixer-${SDL2_mixer_version}.tar.gz
|
||||
pushd SDL2_mixer-${SDL2_mixer_version}
|
||||
|
||||
export SDL2_CONFIG="${install_dir}/built_sdl/bin/sdl2-config"
|
||||
./configure --prefix=${install_dir}/built_sdl_mixer
|
||||
make -j2
|
||||
make install
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function build_fluidsynth {
|
||||
git clone https://github.com/EtherTyper/fluidsynth-lite.git
|
||||
pushd fluidsynth-lite
|
||||
|
||||
# force compilation of dynamic library
|
||||
sed -i'' -e 's/DLL\"\ off/DLL\"\ on/' CMakeLists.txt
|
||||
|
||||
# force 32bit compilation
|
||||
# sed -i'' -e 's/\${GNUCC_WARNING_FLAGS}/-m32 \${GNUCC_WARNING_FLAGS}/' CMakeLists.txt
|
||||
|
||||
# if building fluidsynth fails, move on without it
|
||||
set +e
|
||||
cmake .
|
||||
cmake --build .
|
||||
|
||||
# download a soundfont that's close to the Windows default everyone knows
|
||||
curl -o music.sf2 http://rancid.kapsi.fi/windows.sf2
|
||||
set -e
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
# Actual script starts here
|
||||
|
||||
if [ -d ./build_ext/ ]; then
|
||||
echo A directory named build_ext already exists.
|
||||
echo Please remove it if you want to recompile.
|
||||
exit
|
||||
fi
|
||||
|
||||
mkdir ./build_ext/
|
||||
cd ./build_ext/
|
||||
|
||||
install_dir=$(pwd)
|
||||
|
||||
build_fluidsynth
|
||||
build_sdl
|
||||
build_sdl_mixer
|
||||
|
||||
cd ..
|
||||
|
||||
mkdir -p ./res/
|
||||
|
||||
# move the soundfont to the correct place if we successfully built fluidsynth
|
||||
for i in build_ext/fluidsynth-lite/*.sf2; do [ -f "$i" ] || break; mv $i res/; done;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Shockolate - Portable System Shock
|
||||
============
|
||||
|
||||
1. Copy `res/` folder of original System Shock to this directory
|
||||
2. Install SDL2, SDL2_mixer and Fluidsynth by running `./install_<bits>bit_sdl.sh` where `<bits>` is 32 or 64, depending on your system capabilities. Linux needs `sudo` for this script.
|
||||
3. Run Shockolate `./run.sh`
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
export LD_LIBRARY_PATH="$(pwd)/lib"
|
||||
./systemshock "$@"
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
export DYLD_LIBRARY_PATH="$(pwd)/lib"
|
||||
./systemshock "$@"
|
||||
@@ -0,0 +1,8 @@
|
||||
#version 110
|
||||
|
||||
varying vec4 Color;
|
||||
varying float Light;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vec4(Color.r * Light, Color.g * Light, Color.b * Light, Color.a);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#version 110
|
||||
|
||||
attribute vec2 texcoords;
|
||||
attribute float light;
|
||||
attribute vec4 color;
|
||||
|
||||
varying vec2 TexCoords;
|
||||
varying float Light;
|
||||
varying vec4 Color;
|
||||
|
||||
uniform mat4 view;
|
||||
uniform mat4 proj;
|
||||
|
||||
void main() {
|
||||
TexCoords = texcoords;
|
||||
Light = light;
|
||||
Color = color;
|
||||
gl_Position = proj * view * gl_Vertex;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#version 120
|
||||
|
||||
varying float Light;
|
||||
|
||||
void main() {
|
||||
vec2 mid = vec2(0.5, 0.5) - gl_PointCoord;
|
||||
|
||||
float dist = 0.5 - length(mid);
|
||||
dist *= 3.0;
|
||||
dist = min(dist, 1.0);
|
||||
|
||||
gl_FragColor = vec4(dist * Light, dist * Light, dist * Light, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#version 110
|
||||
|
||||
// The texture alpha value has two separate functions in this shader:
|
||||
// - Pixels with a zero alpha value are transparent.
|
||||
// - Pixels with non-zero alpha are opaque, and the alpha value
|
||||
// defines a minimum light level.
|
||||
|
||||
varying vec2 TexCoords;
|
||||
varying float Light;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform bool nightsight;
|
||||
uniform bool mutant;
|
||||
|
||||
void main() {
|
||||
vec4 t = texture2D(tex, TexCoords);
|
||||
|
||||
// Alpha values > 0.5 are emissive
|
||||
float alpha = t.a > 0.5 ? 1.0 : t.a * 2.0;
|
||||
|
||||
if (nightsight) {
|
||||
// approximate the blue tint of palette colors 0xb0..0xbf
|
||||
float gray = 0.40 * t.r + 0.59 * t.g + 0.11 * t.b;
|
||||
float rg = 0.7 * gray;
|
||||
float b = 0.75 * gray + 0.1;
|
||||
gl_FragColor = vec4(rg, rg, b, (mutant ? 0.2 * alpha : alpha));
|
||||
} else {
|
||||
float emissive = t.a > 0.5 ? (t.a - 0.5) * 2.0 : 0.0;
|
||||
float light = max(Light * Light, emissive);
|
||||
if (mutant)
|
||||
gl_FragColor = vec4(0.5 * t.r * light, 0.5 * t.r * light, 0.5 * t.r * light, 0.2 * alpha);
|
||||
else
|
||||
gl_FragColor = vec4(t.r * light, t.g * light, t.b * light, alpha);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
* FrUtils.c
|
||||
*
|
||||
* MLA - 4/14/95
|
||||
*
|
||||
* Contiains Mac specific utils for the renderer (fast draw slot view, full screen, etc.)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "FrUtils.h"
|
||||
#include "gr2ss.h"
|
||||
#include "Shock.h"
|
||||
#include "2d.h"
|
||||
|
||||
// ------------------
|
||||
// GLOBALS
|
||||
// ------------------
|
||||
//Handle gDoubleSizeOffHdl = NULL;
|
||||
grs_canvas gDoubleSizeOffCanvas;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Allocate the intermediate offscreen buffer for low-res mode in Shock.
|
||||
//---------------------------------------------------------------------
|
||||
/*
|
||||
int AllocDoubleBuffer(int w, int h) {
|
||||
#if 1
|
||||
STUB_ONCE("");
|
||||
return 0;
|
||||
#else
|
||||
Size dummy;
|
||||
|
||||
FreeDoubleBuffer(); // If one's there, free it first.
|
||||
|
||||
if (h == 259) // Major Hack!!! In slot view, the double
|
||||
h++; // buffer needs to be 260 (even number).
|
||||
|
||||
MaxMem(&dummy); // Compact heap before big alloc.
|
||||
|
||||
gDoubleSizeOffHdl = NewHandle(w * h); // Allocate new buffer.
|
||||
if (gDoubleSizeOffHdl) // If successful, make a canvas for it.
|
||||
{
|
||||
HLockHi(gDoubleSizeOffHdl);
|
||||
gr_init_canvas(&gDoubleSizeOffCanvas, (uchar *)*gDoubleSizeOffHdl, BMT_FLAT8, w, h);
|
||||
return 1;
|
||||
} else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
//---------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------
|
||||
/*
|
||||
void FreeDoubleBuffer(void) {
|
||||
if (gDoubleSizeOffHdl) // If there's a buffer,
|
||||
{
|
||||
HUnlock(gDoubleSizeOffHdl);
|
||||
DisposeHandle(gDoubleSizeOffHdl); // free it.
|
||||
gDoubleSizeOffHdl = NULL;
|
||||
}
|
||||
}
|
||||
*/
|
||||
// hard coded to copy from 56,57 to 56+536,57+259 to the screen
|
||||
#define kFastSlotWide 536
|
||||
#define kFastSlotHigh 259
|
||||
#define kFastSlotLeft 28
|
||||
#define kFastSlotTop 24
|
||||
|
||||
#define kFastSlotWide_Half 268
|
||||
#define kFastSlotHigh_Half 129
|
||||
|
||||
#define LoadStoreTwoDoub(a, b) \
|
||||
doub1 = src[a]; \
|
||||
doub2 = src[b]; \
|
||||
dest[a] = doub1; \
|
||||
dest[b] = doub2;
|
||||
|
||||
// copy the slot view from offscreen to on
|
||||
void Fast_Slot_Copy(grs_bitmap *bm) {
|
||||
gr_bitmap(bm, SCONV_X(kFastSlotLeft), SCONV_Y(kFastSlotTop));
|
||||
}
|
||||
|
||||
// copy the full screen view from offscreen to on
|
||||
// hard coded to copy from 0,0 to 640,480 to the screen
|
||||
void Fast_FullScreen_Copy(grs_bitmap *bm) { gr_bitmap(bm, 0, 0); }
|
||||
|
||||
//=================================================================
|
||||
// Doubling routines
|
||||
extern bool SkipLines;
|
||||
|
||||
// copy the slot view from offscreen to on, doubling it
|
||||
// extern "C"
|
||||
//{
|
||||
//extern void BlitLargeAlign(uchar *draw_buffer, int dstRowBytes, void *dstPtr, long w, long h, long modulus);
|
||||
//extern void BlitLargeAlignSkip(uchar *draw_buffer, int dstRowBytes, void *dstPtr, long w, long h, long modulus);
|
||||
//}
|
||||
|
||||
/*
|
||||
void Fast_Slot_Double(grs_bitmap *bm, long w, long h) {
|
||||
if (!SkipLines)
|
||||
BlitLargeAlign(bm->bits, gScreenRowbytes, gScreenAddress + (kFastSlotTop * gScreenRowbytes) + kFastSlotLeft, w,
|
||||
h, bm->row);
|
||||
else
|
||||
BlitLargeAlignSkip(bm->bits, gScreenRowbytes, gScreenAddress + (kFastSlotTop * gScreenRowbytes) + kFastSlotLeft,
|
||||
w, h, bm->row);
|
||||
}
|
||||
*/
|
||||
|
||||
void FastSlotDouble2Canvas(grs_bitmap *bm, grs_canvas *destCanvas, long w, long h) {
|
||||
if (SkipLines) {
|
||||
gr_clear(0xFF);
|
||||
// BlitLargeAlignSkip(bm->bits, destCanvas->bm.row, destCanvas->bm.bits, w, h + 1, bm->row);
|
||||
} else {
|
||||
// BlitLargeAlign(bm->bits, destCanvas->bm.row, destCanvas->bm.bits, w, h + 1, bm->row);
|
||||
}
|
||||
}
|
||||
|
||||
// copy the full screen view from offscreen to on
|
||||
// hard coded to copy from 0,0 to 640,480 to the screen
|
||||
/*
|
||||
void Fast_FullScreen_Double(grs_bitmap *bm, long w, long h) {
|
||||
if (!SkipLines)
|
||||
BlitLargeAlign(bm->bits, gScreenRowbytes, gScreenAddress, w, h, bm->row);
|
||||
else
|
||||
BlitLargeAlignSkip(bm->bits, gScreenRowbytes, gScreenAddress, w, h, bm->row);
|
||||
}
|
||||
*/
|
||||
|
||||
void FastFullscreenDouble2Canvas(grs_bitmap *bm, grs_canvas *destCanvas, long w, long h) {
|
||||
if (SkipLines) {
|
||||
gr_clear(0xFF);
|
||||
// BlitLargeAlignSkip(bm->bits, destCanvas->bm.row, destCanvas->bm.bits, w, h + 1, bm->row);
|
||||
} else {
|
||||
// BlitLargeAlign(bm->bits, destCanvas->bm.row, destCanvas->bm.bits, w, h + 1, bm->row);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
// externs for functions in FrUtils.C
|
||||
|
||||
extern void Fast_Slot_Copy(grs_bitmap *bm);
|
||||
extern void Fast_FullScreen_Copy(grs_bitmap *bm);
|
||||
// extern void Fast_Slot_Double(grs_bitmap *bm, long w, long h);
|
||||
// extern void Fast_FullScreen_Double(grs_bitmap *bm, long w, long h);
|
||||
|
||||
void FastSlotDouble2Canvas(grs_bitmap *bm, grs_canvas *destCanvas, long w, long h);
|
||||
void FastFullscreenDouble2Canvas(grs_bitmap *bm, grs_canvas *destCanvas, long w, long h);
|
||||
|
||||
// Stuff for the low-res temporary offscreen buffer.
|
||||
extern grs_canvas gDoubleSizeOffCanvas;
|
||||
|
||||
// int AllocDoubleBuffer(int w, int h);
|
||||
// void FreeDoubleBuffer(void);
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __AI_H
|
||||
#define __AI_H
|
||||
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/ai.h $
|
||||
* $Revision: 1.22 $
|
||||
* $Author: xemu $
|
||||
* $Date: 1994/06/21 02:14:10 $
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// Includes
|
||||
#include "objects.h"
|
||||
|
||||
// Defines
|
||||
#define NUM_AI_MOODS 5
|
||||
#define AI_MOOD_FRIENDLY 0
|
||||
#define AI_MOOD_NEUTRAL 1
|
||||
#define AI_MOOD_HOSTILE 2
|
||||
#define AI_MOOD_ISOLATION 3
|
||||
#define AI_MOOD_ATTACKING 4
|
||||
|
||||
#define NUM_AI_ORDERS 6
|
||||
#define AI_ORDERS_GUARD 0 // hang out until player comes around
|
||||
#define AI_ORDERS_ROAM 1 // wander about
|
||||
#define AI_ORDERS_SLEEP 2 // do nothing ever until awakened
|
||||
#define AI_ORDERS_PATROL 3 // back n forth between 2 points
|
||||
#define AI_ORDERS_HIGHWAY 4 // follow invisible highway
|
||||
#define AI_ORDERS_NOMOVE 5 // like guard, but will never move
|
||||
|
||||
#define AI_FLAG_NONE 0x00
|
||||
#define AI_FLAG_FLYING 0x01 // we can fly
|
||||
#define AI_FLAG_NOALERT 0x02 // don't speed up reaction when in combat
|
||||
#define AI_FLAG_SMALL 0x04 // for musicai
|
||||
|
||||
#define SPREAD_DIST 2
|
||||
|
||||
#define SLOW_PROJECTILE_DURATION 1000
|
||||
#define SLOW_PROJECTILE_GRAVITY fix_make(0,0x0C00)
|
||||
|
||||
// Macros
|
||||
|
||||
// Prototypes
|
||||
|
||||
errtype set_posture_safe(ObjSpecID osid, ubyte new_pos);
|
||||
errtype set_posture_movesafe(ObjSpecID osid, ubyte new_pos);
|
||||
errtype clear_critter_controls(ObjSpecID osid);
|
||||
errtype apply_EDMS_controls(ObjSpecID osid);
|
||||
errtype roll_on_dnd_treasure_tables(int *pcont, char treasure_type);
|
||||
|
||||
// External Functions:
|
||||
|
||||
// Let all the AI system spend time figuring out what to do. Those AIs that know what they are doing,
|
||||
// do it, others plan, the time load is hopefully distributed as nicely as possible
|
||||
errtype ai_run(void);
|
||||
|
||||
// What do do when we are hit
|
||||
errtype ai_critter_hit(ObjSpecID osid, short damage, uchar tranq, uchar stun);
|
||||
|
||||
// When we pretend that we're dead (pretend we're dead)
|
||||
errtype ai_critter_die(ObjSpecID osid);
|
||||
errtype ai_critter_really_dead(ObjSpecID osid);
|
||||
|
||||
// actually do attack
|
||||
errtype ai_attack_player(ObjSpecID osid, char a);
|
||||
|
||||
errtype ai_fire_special(ObjID src, ObjID target, int proj_triple, ObjLoc src_loc, ObjLoc target_loc, uchar a,
|
||||
int duration);
|
||||
|
||||
// Change a critter's posture, and do appropriate
|
||||
// things to other anim variables
|
||||
errtype set_posture(ObjSpecID osid, ubyte new_pos);
|
||||
|
||||
// Looting.
|
||||
errtype do_regular_loot(ObjSpecID source_critter, ObjID corpse);
|
||||
errtype do_random_loot(ObjID corpse);
|
||||
|
||||
void ai_find_player(ObjID id);
|
||||
void ai_critter_seen(void);
|
||||
void ai_misses(ObjSpecID osid);
|
||||
|
||||
// Globals
|
||||
|
||||
#endif // __AI_H
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#define AI_FLAG_CHASING 0x0001
|
||||
#define AI_FLAG_NOLOOT 0x0002
|
||||
#define AI_FLAG_CONFUSED 0x0004
|
||||
#define AI_FLAG_TRANQ 0x0010
|
||||
|
||||
#define ai_critter_sleeping(osid) \
|
||||
((objCritters[(osid)].orders == AI_ORDERS_SLEEP) || (objCritters[(osid)].flags & AI_FLAG_TRANQ))
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef AIRUPT_H
|
||||
#define AIRUPT_H
|
||||
|
||||
errtype check_asynch_ai(uchar new_score_ok);
|
||||
void grind_music_ai(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __AMAP_H
|
||||
#define __AMAP_H
|
||||
|
||||
// header for the real infernal automap
|
||||
|
||||
// defines
|
||||
#define AMAP_PURE_MODE 0x0000
|
||||
#define AMAP_INT_WALLS 0x0001
|
||||
#define AMAP_SHOW_CRIT 0x0002
|
||||
#define AMAP_SHOW_ROB 0x0004
|
||||
#define AMAP_SHOW_HAZ 0x0008
|
||||
#define AMAP_SHOW_FLR 0x0010
|
||||
#define AMAP_SHOW_MSG 0x0020
|
||||
#define AMAP_SHOW_HGT 0x0040
|
||||
#define AMAP_TRACK_OBJ 0x0080
|
||||
#define AMAP_SHOW_SEC 0x0100
|
||||
#define AMAP_FULL_MSG 0x0200
|
||||
#define AMAP_SHOW_ALL 0x0400
|
||||
#define AMAP_SHOW_SENS 0x0800
|
||||
|
||||
#define AMAP_AVAIL_ALWAYS (AMAP_SHOW_SENS | AMAP_SHOW_FLR | AMAP_FULL_MSG)
|
||||
|
||||
#define AMAP_SET 1
|
||||
#define AMAP_UNSET 0
|
||||
#define AMAP_TOGGLE -1
|
||||
|
||||
#define AMAP_PAN_N 1
|
||||
#define AMAP_PAN_E 2
|
||||
#define AMAP_PAN_S 3
|
||||
#define AMAP_PAN_W 4
|
||||
#define AMAP_DEF_DST 0x40000
|
||||
|
||||
#define AMAP_MAX_ZOOM 6
|
||||
#define AMAP_MIN_ZOOM 1
|
||||
|
||||
#define AMAP_OFF_MAP 0
|
||||
#define AMAP_HAVE_NOTE 1
|
||||
#define AMAP_NO_NOTE 2
|
||||
|
||||
// really should live in the player structure....
|
||||
typedef struct {
|
||||
uchar init;
|
||||
uchar zoom;
|
||||
int xf, yf;
|
||||
ushort lw, lh;
|
||||
ushort obj_to_follow, sensor_obj;
|
||||
ushort note_obj;
|
||||
ushort flags;
|
||||
ushort avail_flags;
|
||||
uchar version_id;
|
||||
ushort sensor_rad; // in obj coords
|
||||
} curAMap;
|
||||
|
||||
// prototypes
|
||||
uchar amap_kb_callback(curAMap *amptr, int code);
|
||||
void amap_draw(curAMap *amptr, int expose);
|
||||
void amap_version_set(int id, int new_ver);
|
||||
void automap_init(int version, int id);
|
||||
void amap_invalidate(int id);
|
||||
uchar amap_flags(curAMap *amptr, int flags, int set); // set -1 to toggle
|
||||
uchar amap_zoom(curAMap *amptr, uchar set, int zoom_delta);
|
||||
void amap_pan(curAMap *amptr, int dir, int *dist);
|
||||
uchar amap_get_note(curAMap *amptr, char *buf);
|
||||
void amap_pixratio_set(fix ratio);
|
||||
void amap_settings_copy(curAMap *from, curAMap *to);
|
||||
|
||||
grs_bitmap *screen_automap_bitmap(char which_amap);
|
||||
|
||||
// this is a mess
|
||||
// it modifies x and y to be map location of click
|
||||
// returns null if off map, (void*)mapelemptr if within map
|
||||
// sets amptr->note_obj to the note if found, else OBJ_NULL
|
||||
void *amap_deal_with_map_click(curAMap *amptr, int *x, int *y);
|
||||
|
||||
// strings
|
||||
void amap_str_init(void);
|
||||
char *amap_str_next(void);
|
||||
void amap_str_grab(char *str);
|
||||
int amap_str_deref(char *str);
|
||||
char *amap_str_reref(int offs);
|
||||
void amap_str_delete(char *toast_str);
|
||||
void amap_str_startup(int magic_num);
|
||||
|
||||
#define MFD_FULLSCR_MAP 2
|
||||
#define NUM_O_AMAP MFD_FULLSCR_MAP + 1
|
||||
|
||||
// globals
|
||||
// for now
|
||||
|
||||
#define oAMap(mid) (&(level_gamedata.auto_maps[mid]))
|
||||
//#define oAMap(mid) (auto_maps[mid])
|
||||
|
||||
#define amap_reset() \
|
||||
do { \
|
||||
int i; \
|
||||
for (i = 0; i < NUM_O_AMAP; i++) \
|
||||
amap_invalidate(i); \
|
||||
} while (0)
|
||||
|
||||
#define amap_note_value(objid) (objTraps[objs[objid].specID].p4)
|
||||
#define amap_note_string(objid) (amap_str_reref(amap_note_value(objid)))
|
||||
|
||||
#define AMAP_STRING_SIZE 2048
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/amaploop.h $
|
||||
* $Revision: 1.1 $
|
||||
* $Author: dc $
|
||||
* $Date: 1994/04/06 07:27:10 $
|
||||
*/
|
||||
|
||||
#include "amap.h"
|
||||
|
||||
#define AMAP_FULLEXPOSE (LL_CHG_BASE << 1)
|
||||
#define AMAP_MAP_EV (LL_CHG_BASE << 2)
|
||||
#define AMAP_BUTTON_EV (LL_CHG_BASE << 3)
|
||||
#define AMAP_MESSAGE_EV (LL_CHG_BASE << 4)
|
||||
|
||||
uchar amap_ms_callback(curAMap *amptr, int x, int y, short action, ubyte but);
|
||||
uchar amap_scroll_handler(uiEvent *ev, LGRegion *r, intptr_t user_data);
|
||||
void automap_loop(void);
|
||||
char *fsmap_get_lev_str(char *buf, int siz);
|
||||
void fsmap_startup(void);
|
||||
void fsmap_free(void);
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef AMMOMFD_H
|
||||
#define AMMOMFD_H
|
||||
|
||||
#include "event.h"
|
||||
#include "mfdint.h"
|
||||
|
||||
void mfd_ammo_expose(ubyte control);
|
||||
uchar mfd_ammo_handler(MFD *m, uiEvent *ev);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,80 @@
|
||||
#ifndef ANIM_H
|
||||
#define ANIM_H
|
||||
|
||||
#include <rect.h>
|
||||
//#include <llist.h>
|
||||
#include <res.h>
|
||||
#include <2d.h>
|
||||
#include <2dres.h>
|
||||
#include <fix.h>
|
||||
|
||||
// Animation event codes
|
||||
|
||||
typedef uchar AnimCode;
|
||||
|
||||
#define ANCODE_NEWFRAME 0x01 // new frame, update screen
|
||||
#define ANCODE_END 0x04 // end anim w/o kill (no arg)
|
||||
#define ANCODE_KILL 0x08 // kill anim (no arg)
|
||||
|
||||
typedef struct {
|
||||
uchar unknown;
|
||||
uchar frameRunStart;
|
||||
uchar frameRunEnd;
|
||||
fix frameDelay;
|
||||
} AnimCodeData;
|
||||
|
||||
typedef struct {
|
||||
LGPoint size; // size of anim
|
||||
Id frameSetId; // resource id of binary frame set
|
||||
uchar unknown1[6];
|
||||
short unknown2;
|
||||
AnimCodeData data[];
|
||||
} AnimHead;
|
||||
|
||||
// ActAnim: describes an active animation record
|
||||
|
||||
typedef struct ActAnim_ {
|
||||
LGRegion *reg;
|
||||
AnimHead *pah; // ptr to animation header
|
||||
LGPoint loc;
|
||||
grs_canvas cnv;
|
||||
void (*notifyFunc) (struct ActAnim_ *paa, AnimCode ancode, AnimCodeData *animData); // owner evt handler
|
||||
void (*composeFunc) (LGRect *area, ubyte flags); // owner compose handler
|
||||
Ref currFrameRef; // current frame ref
|
||||
int curSeq;
|
||||
int frameNum;
|
||||
fix animRate; // animation rate
|
||||
ulong timeContinue; // time at which to advance to next step
|
||||
void *dataBuffer; // data buffer to use for frames, or NULL
|
||||
long dataBufferLen; // length of data buffer
|
||||
} ActAnim;
|
||||
|
||||
// General prototypes: anim.c
|
||||
|
||||
void AnimRecur(); // update animations in progress
|
||||
|
||||
// Play and control anims: anim.c
|
||||
|
||||
ActAnim *AnimPlayRegion(Ref animRef, LGRegion *region, LGPoint loc, char unknown, // play anim into canvas
|
||||
void (*composeFunc)(LGRect *area, ubyte flags));
|
||||
|
||||
void AnimKill(ActAnim *paa); // kill one or all anims
|
||||
void AnimSetNotify(ActAnim *paa, void *powner, AnimCode mask,
|
||||
void (*func) (ActAnim *, AnimCode ancode, AnimCodeData *animData));
|
||||
|
||||
// Deal with animation resources: anim.c
|
||||
|
||||
bool AnimPreloadFrames(ActAnim *paa, Ref animRef); // preload an anim's frames
|
||||
|
||||
// Macro to read anim header from resource
|
||||
|
||||
#define AnimReadHeader(ref,pAnhead) (*pAnhead = (* ((AnimHead *) RefGet(ref))));
|
||||
|
||||
// Convenience macros
|
||||
|
||||
#define AnimSetDataBuffer(paa, buffer) { \
|
||||
(paa)->dataBuffer = (buffer); (paa)->dataBufferLen = 0x7FFFFFFFL; }
|
||||
#define AnimSetDataBufferSafe(paa, buffer, len) { \
|
||||
(paa)->dataBuffer = (buffer); (paa)->dataBufferLen = (len); }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#if !defined(ARCHIVEFORMAT_H)
|
||||
#define ARCHIVEFORMAT_H
|
||||
|
||||
#include "res.h"
|
||||
|
||||
// A single 32-bit integer. A couple of resources are just a number.
|
||||
extern const ResourceFormat U32Format;
|
||||
#define FORMAT_U32 (&U32Format)
|
||||
|
||||
// The schedules have fixed resource IDs and do not form part of the main
|
||||
// archive tables.
|
||||
extern const ResourceFormat ScheduleFormat;
|
||||
#define FORMAT_SCHEDULE (&ScheduleFormat)
|
||||
|
||||
extern const ResourceFormat ScheduleQueueFormat;
|
||||
#define FORMAT_SCHEDULE_QUEUE (&ScheduleQueueFormat)
|
||||
|
||||
// Master tables for level archives.
|
||||
#define MAX_LEVEL_INDEX 51 // based from xx02; level resources go up to xx53
|
||||
extern const ResourceFormat LevelVersion11Format[MAX_LEVEL_INDEX+1];
|
||||
extern const ResourceFormat LevelVersion12Format[MAX_LEVEL_INDEX+1];
|
||||
|
||||
#endif // !defined(ARCHIVEFORMAT_H)
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/audiolog.h $
|
||||
* $Revision: 1.4 $
|
||||
* $Author: dc $
|
||||
* $Date: 1994/11/19 20:44:42 $
|
||||
*/
|
||||
|
||||
//#include "error.h"
|
||||
//#include "lg.h"
|
||||
|
||||
extern errtype audiolog_init();
|
||||
extern errtype audiolog_play(int email_id);
|
||||
extern errtype audiolog_bark_play(int bark_id);
|
||||
extern void audiolog_stop();
|
||||
extern errtype audiolog_loop_callback();
|
||||
extern bool audiolog_playing(int email_id);
|
||||
|
||||
extern uchar audiolog_setting;
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __AUTOMAP_H
|
||||
#define __AUTOMAP_H
|
||||
|
||||
/*
|
||||
* $Source: q:/inc/RCS/automap.h $
|
||||
* $Revision: 1.5 $
|
||||
* $Author: xemu $
|
||||
* $Date: 1993/09/02 23:06:30 $
|
||||
*
|
||||
* $Log: automap.h $
|
||||
* Revision 1.5 1993/09/02 23:06:30 xemu
|
||||
* angle me baby
|
||||
*
|
||||
* Revision 1.4 1993/08/09 20:45:21 spaz
|
||||
* Changed some #define's.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 1993/08/09 14:33:12 mahk
|
||||
* Fixed syntax errors
|
||||
*
|
||||
* Revision 1.2 1993/08/09 13:27:47 spaz
|
||||
* Linked automap stub functions to the MFD system.
|
||||
*
|
||||
* Revision 1.1 1993/05/03 11:51:58 xemu
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// Includes
|
||||
#include "rect.h"
|
||||
|
||||
// C Library Includes
|
||||
|
||||
// System Library Includes
|
||||
|
||||
// Master Game Includes
|
||||
|
||||
// Game Library Includes
|
||||
|
||||
// Game Object Includes
|
||||
|
||||
// Defines
|
||||
typedef struct _AutoText {
|
||||
char *letters;
|
||||
LGPoint coordinate;
|
||||
int color;
|
||||
struct _AutoText *next_entry;
|
||||
} AutoText;
|
||||
|
||||
#define AUTOMAP_TERRAIN 0x0001
|
||||
#define AUTOMAP_ELEVATION 0x0002
|
||||
#define AUTOMAP_SECURITY 0x0004
|
||||
#define AUTOMAP_CRITTERS 0x0008
|
||||
#define AUTOMAP_INFORMATION 0x0010
|
||||
#define AUTOMAP_ALIGNMENT 0x0020
|
||||
|
||||
#define AUTOMAP_ZOOMIN_X 16
|
||||
#define AUTOMAP_ZOOMIN_Y 16
|
||||
#define AUTOMAP_ZOOMOUT_X 32
|
||||
#define AUTOMAP_ZOOMOUT_Y 32
|
||||
|
||||
// Prototypes
|
||||
|
||||
// Specify which level is the "current" automap level for viewing
|
||||
errtype automap_current(int level);
|
||||
|
||||
// Set what kinds of information are shown by the automap
|
||||
errtype automap_infotype(ulong map_info);
|
||||
|
||||
// Draw the automap, scaled to specified size, in the area with upper left corner
|
||||
// as specified.
|
||||
errtype automap_draw(int map_size, LGPoint ul_coord);
|
||||
|
||||
// Get a handle to a new text entry field on the automap, at specified coords
|
||||
errtype automap_new_entry(LGPoint coord, AutoText *new_text);
|
||||
|
||||
// Delete a given text entry
|
||||
errtype automap_delete_entry(AutoText *victim);
|
||||
|
||||
// Stubs for the MFD system
|
||||
void mfd_map_expose(MFD *m, ubyte control);
|
||||
errtype mfd_map_init(MFD_Func *);
|
||||
uchar mfd_map_handler(MFD *m, uiEvent *e);
|
||||
|
||||
// Globals
|
||||
|
||||
#endif // __AUTOMAP_H
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/bark.h $
|
||||
* $Revision: 1.3 $
|
||||
* $Author: tjs $
|
||||
* $Date: 1994/08/02 13:56:04 $
|
||||
*
|
||||
* $Log: bark.h $
|
||||
* Revision 1.3 1994/08/02 13:56:04 tjs
|
||||
* Rescaled bark timeouts.
|
||||
*
|
||||
* Revision 1.2 1994/05/26 20:52:23 tjs
|
||||
* Added null bark timeout
|
||||
*
|
||||
* Revision 1.1 1994/05/26 17:59:08 tjs
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef BARK_H
|
||||
#define BARK_H
|
||||
|
||||
#include "mfdint.h" // for MFD struct
|
||||
|
||||
#define MFD_BARK_FUNC 17
|
||||
|
||||
#define NULL_BARK_TIMEOUT 3
|
||||
|
||||
#define mfd_bark_string (*(int *)(&player_struct.mfd_func_data[MFD_BARK_FUNC][0]))
|
||||
#define mfd_bark_speaker (*(ObjID *)(&player_struct.mfd_func_data[MFD_BARK_FUNC][sizeof(int)]))
|
||||
#define mfd_bark_color (player_struct.mfd_func_data[MFD_BARK_FUNC][sizeof(int) + sizeof(ObjID)])
|
||||
#define mfd_bark_mug (player_struct.mfd_func_data[MFD_BARK_FUNC][sizeof(int) + sizeof(ObjID) + sizeof(uchar)])
|
||||
|
||||
void mfd_bark_expose(MFD *mfd, ubyte control);
|
||||
void long_bark(ObjID speaker_id, uchar mug_id, int string_id, ubyte color);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef BIOHELP_H
|
||||
#define BIOHELP_H
|
||||
|
||||
#include "mfdint.h"
|
||||
|
||||
errtype biohelp_load_cursor();
|
||||
|
||||
errtype mfd_biohelp_init(MFD_Func *f);
|
||||
void mfd_biohelp_expose(MFD *mfd, ubyte control);
|
||||
uchar mfd_biohelp_handler(MFD *m, uiEvent *e);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __BIOTRAX_H
|
||||
#define __BIOTRAX_H
|
||||
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/biotrax.h $
|
||||
* $Revision: 1.1 $
|
||||
* $Author: mahk $
|
||||
* $Date: 1994/02/23 13:20:34 $
|
||||
*
|
||||
*/
|
||||
|
||||
// Defines
|
||||
#define ENERGY_TRACK 0
|
||||
#define BIOHAZARD_TRACK (ENERGY_TRACK + 1)
|
||||
#define RADIATION_TRACK (BIOHAZARD_TRACK + 1)
|
||||
#define LOOPLINE_TRACK (RADIATION_TRACK + 1)
|
||||
#define HEART_TRACK (NUM_BIO_TRACKS - 2)
|
||||
#define SINE_TRACK (NUM_BIO_TRACKS - 1)
|
||||
|
||||
// Prototypes
|
||||
|
||||
// Globals
|
||||
|
||||
#endif // __BIOTRAX_H
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __CANVCHEK_H
|
||||
#define __CANVCHEK_H
|
||||
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/canvchek.h $
|
||||
* $Revision: 1.1 $
|
||||
* $Author: mahk $
|
||||
* $Date: 1994/11/09 20:44:24 $
|
||||
*
|
||||
*/
|
||||
|
||||
#define is_onscreen() (grd_canvas != NULL && grd_canvas->bm.type == BMT_DEVICE)
|
||||
|
||||
#endif // __CANVCHEK_H
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CARDMFD_H
|
||||
#define CARDMFD_H
|
||||
|
||||
void mfd_accesscard_expose(MFD *mfd, ubyte control);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __CIT2D_H
|
||||
#define __CIT2D_H
|
||||
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/cit2d.h $
|
||||
* $Revision: 1.4 $
|
||||
* $Author: mahk $
|
||||
* $Date: 1994/08/18 17:20:17 $
|
||||
*
|
||||
*/
|
||||
|
||||
// Stuff that we wish the 2d had, but is too cool.
|
||||
|
||||
#define FONT_IS_MONO(fontptr) ((fontptr)->id != 0xCCCC)
|
||||
|
||||
void draw_shadowed_string(char *s, short x, short y, uchar shadow);
|
||||
|
||||
#ifdef BROKEN_SAFE_CLIPRECT
|
||||
#define safe_set_cliprect(a, b, c, d) \
|
||||
do { \
|
||||
short _safe_x = a; \
|
||||
short _safe_y = b; \
|
||||
short _safe_p = c; \
|
||||
short _safe_q = d; \
|
||||
gr_safe_set_cliprect(_safe_x, _safe_y, _safe_p, _safe_q); \
|
||||
} while (0)
|
||||
#else
|
||||
#define safe_set_cliprect(a, b, c, d) gr_safe_set_cliprect(a, b, c, d)
|
||||
#endif
|
||||
|
||||
#endif // __CIT2D_H
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/* This file created by RESTOOL */
|
||||
|
||||
#ifndef __CITALOG_H
|
||||
#define __CITALOG_H
|
||||
|
||||
#define RES_alog_email0 0xab5 // (2741)
|
||||
#define RES_alog_email1 0xab6 // (2742)
|
||||
#define RES_alog_email2 0xab7 // (2743)
|
||||
#define RES_alog_email3 0xab8 // (2744)
|
||||
#define RES_alog_email4 0xab9 // (2745)
|
||||
#define RES_alog_email5 0xaba // (2746)
|
||||
#define RES_alog_email6 0xabb // (2747)
|
||||
#define RES_alog_email7 0xabc // (2748)
|
||||
#define RES_alog_email8 0xabd // (2749)
|
||||
#define RES_alog_email9 0xabe // (2750)
|
||||
#define RES_alog_email10 0xabf // (2751)
|
||||
#define RES_alog_email11 0xac0 // (2752)
|
||||
#define RES_alog_email12 0xac1 // (2753)
|
||||
#define RES_alog_email13 0xac2 // (2754)
|
||||
#define RES_alog_email14 0xac3 // (2755)
|
||||
#define RES_alog_email15 0xac4 // (2756)
|
||||
#define RES_alog_email16 0xac5 // (2757)
|
||||
#define RES_alog_email17 0xac6 // (2758)
|
||||
#define RES_alog_email18 0xac7 // (2759)
|
||||
#define RES_alog_email19 0xac8 // (2760)
|
||||
#define RES_alog_email20 0xac9 // (2761)
|
||||
#define RES_alog_email21 0xaca // (2762)
|
||||
#define RES_alog_email22 0xacb // (2763)
|
||||
#define RES_alog_email23 0xacc // (2764)
|
||||
#define RES_alog_email24 0xacd // (2765)
|
||||
#define RES_alog_email25 0xace // (2766)
|
||||
#define RES_alog_email26 0xacf // (2767)
|
||||
#define RES_alog_email27 0xad0 // (2768)
|
||||
#define RES_alog_email28 0xad1 // (2769)
|
||||
#define RES_alog_email29 0xad2 // (2770)
|
||||
#define RES_alog_log00 0xae4 // (2788)
|
||||
#define RES_alog_log01 0xae5 // (2789)
|
||||
#define RES_alog_log02 0xae6 // (2790)
|
||||
#define RES_alog_log03 0xae7 // (2791)
|
||||
#define RES_alog_log04 0xae8 // (2792)
|
||||
#define RES_alog_log05 0xae9 // (2793)
|
||||
#define RES_alog_log10 0xaf4 // (2804)
|
||||
#define RES_alog_log11 0xaf5 // (2805)
|
||||
#define RES_alog_log12 0xaf6 // (2806)
|
||||
#define RES_alog_log13 0xaf7 // (2807)
|
||||
#define RES_alog_log14 0xaf8 // (2808)
|
||||
#define RES_alog_log15 0xaf9 // (2809)
|
||||
#define RES_alog_log16 0xafa // (2810)
|
||||
#define RES_alog_log17 0xafb // (2811)
|
||||
#define RES_alog_log18 0xafc // (2812)
|
||||
#define RES_alog_log19 0xafd // (2813)
|
||||
#define RES_alog_log110 0xafe // (2814)
|
||||
#define RES_alog_log111 0xaff // (2815)
|
||||
#define RES_alog_log112 0xb00 // (2816)
|
||||
#define RES_alog_log113 0xb01 // (2817)
|
||||
#define RES_alog_log114 0xb02 // (2818)
|
||||
#define RES_alog_log115 0xb03 // (2819)
|
||||
#define RES_alog_log20 0xb04 // (2820)
|
||||
#define RES_alog_log21 0xb05 // (2821)
|
||||
#define RES_alog_log22 0xb06 // (2822)
|
||||
#define RES_alog_log23 0xb07 // (2823)
|
||||
#define RES_alog_log24 0xb08 // (2824)
|
||||
#define RES_alog_log25 0xb09 // (2825)
|
||||
#define RES_alog_log26 0xb0a // (2826)
|
||||
#define RES_alog_log27 0xb0b // (2827)
|
||||
#define RES_alog_log28 0xb0c // (2828)
|
||||
#define RES_alog_log29 0xb0d // (2829)
|
||||
#define RES_alog_log210 0xb0e // (2830)
|
||||
#define RES_alog_log211 0xb0f // (2831)
|
||||
#define RES_alog_log212 0xb10 // (2832)
|
||||
#define RES_alog_log30 0xb14 // (2836)
|
||||
#define RES_alog_log31 0xb15 // (2837)
|
||||
#define RES_alog_log32 0xb16 // (2838)
|
||||
#define RES_alog_log33 0xb17 // (2839)
|
||||
#define RES_alog_log34 0xb18 // (2840)
|
||||
#define RES_alog_log35 0xb19 // (2841)
|
||||
#define RES_alog_log36 0xb1a // (2842)
|
||||
#define RES_alog_log37 0xb1b // (2843)
|
||||
#define RES_alog_log38 0xb1c // (2844)
|
||||
#define RES_alog_log40 0xb24 // (2852)
|
||||
#define RES_alog_log41 0xb25 // (2853)
|
||||
#define RES_alog_log42 0xb26 // (2854)
|
||||
#define RES_alog_log43 0xb27 // (2855)
|
||||
#define RES_alog_log44 0xb28 // (2856)
|
||||
#define RES_alog_log45 0xb29 // (2857)
|
||||
#define RES_alog_log46 0xb2a // (2858)
|
||||
#define RES_alog_log50 0xb34 // (2868)
|
||||
#define RES_alog_log51 0xb35 // (2869)
|
||||
#define RES_alog_log52 0xb36 // (2870)
|
||||
#define RES_alog_log53 0xb37 // (2871)
|
||||
#define RES_alog_log54 0xb38 // (2872)
|
||||
#define RES_alog_log55 0xb39 // (2873)
|
||||
#define RES_alog_log56 0xb3a // (2874)
|
||||
#define RES_alog_log57 0xb3b // (2875)
|
||||
#define RES_alog_log58 0xb3c // (2876)
|
||||
#define RES_alog_log59 0xb3d // (2877)
|
||||
#define RES_alog_log510 0xb3e // (2878)
|
||||
#define RES_alog_log511 0xb3f // (2879)
|
||||
#define RES_alog_log60 0xb44 // (2884)
|
||||
#define RES_alog_log61 0xb45 // (2885)
|
||||
#define RES_alog_log62 0xb46 // (2886)
|
||||
#define RES_alog_log63 0xb47 // (2887)
|
||||
#define RES_alog_log64 0xb48 // (2888)
|
||||
#define RES_alog_log65 0xb49 // (2889)
|
||||
#define RES_alog_log66 0xb4a // (2890)
|
||||
#define RES_alog_log67 0xb4b // (2891)
|
||||
#define RES_alog_log68 0xb4c // (2892)
|
||||
#define RES_alog_log69 0xb4d // (2893)
|
||||
#define RES_alog_log70 0xb54 // (2900)
|
||||
#define RES_alog_log71 0xb55 // (2901)
|
||||
#define RES_alog_log72 0xb56 // (2902)
|
||||
#define RES_alog_log73 0xb57 // (2903)
|
||||
#define RES_alog_log74 0xb58 // (2904)
|
||||
#define RES_alog_log75 0xb59 // (2905)
|
||||
#define RES_alog_log76 0xb5a // (2906)
|
||||
#define RES_alog_log77 0xb5b // (2907)
|
||||
#define RES_alog_log78 0xb5c // (2908)
|
||||
#define RES_alog_log80 0xb64 // (2916)
|
||||
#define RES_alog_log81 0xb65 // (2917)
|
||||
#define RES_alog_log82 0xb66 // (2918)
|
||||
#define RES_alog_log83 0xb67 // (2919)
|
||||
#define RES_alog_log84 0xb68 // (2920)
|
||||
#define RES_alog_log85 0xb69 // (2921)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/* This file created by RESTOOL */
|
||||
|
||||
#ifndef __CITBARK_H
|
||||
#define __CITBARK_H
|
||||
|
||||
#define RES_alog_bark0 0xc1c // (3100)
|
||||
#define RES_alog_bark1 0xc1d // (3101)
|
||||
#define RES_alog_bark2 0xc1e // (3102)
|
||||
#define RES_alog_bark3 0xc1f // (3103)
|
||||
#define RES_alog_bark4 0xc20 // (3104)
|
||||
#define RES_alog_bark5 0xc21 // (3105)
|
||||
#define RES_alog_bark6 0xc22 // (3106)
|
||||
#define RES_alog_bark7 0xc23 // (3107)
|
||||
#define RES_alog_bark8 0xc24 // (3108)
|
||||
#define RES_alog_bark9 0xc25 // (3109)
|
||||
#define RES_alog_bark10 0xc26 // (3110)
|
||||
#define RES_alog_bark11 0xc27 // (3111)
|
||||
#define RES_alog_bark12 0xc28 // (3112)
|
||||
#define RES_alog_bark13 0xc29 // (3113)
|
||||
#define RES_alog_bark14 0xc2a // (3114)
|
||||
#define RES_alog_bark15 0xc2b // (3115)
|
||||
#define RES_alog_bark16 0xc2c // (3116)
|
||||
#define RES_alog_bark17 0xc2d // (3117)
|
||||
#define RES_alog_bark18 0xc2e // (3118)
|
||||
#define RES_alog_bark19 0xc2f // (3119)
|
||||
#define RES_alog_bark20 0xc30 // (3120)
|
||||
#define RES_alog_bark21 0xc31 // (3121)
|
||||
#define RES_alog_bark22 0xc32 // (3122)
|
||||
#define RES_alog_bark23 0xc33 // (3123)
|
||||
#define RES_alog_bark24 0xc34 // (3124)
|
||||
#define RES_alog_bark25 0xc35 // (3125)
|
||||
#define RES_alog_bark26 0xc36 // (3126)
|
||||
#define RES_alog_bark27 0xc37 // (3127)
|
||||
#define RES_alog_bark28 0xc38 // (3128)
|
||||
#define RES_alog_bark29 0xc39 // (3129)
|
||||
#define RES_alog_bark30 0xc3a // (3130)
|
||||
#define RES_alog_bark31 0xc3b // (3131)
|
||||
#define RES_alog_bark32 0xc3c // (3132)
|
||||
#define RES_alog_bark33 0xc3d // (3133)
|
||||
#define RES_alog_bark34 0xc3e // (3134)
|
||||
#define RES_alog_bark35 0xc3f // (3135)
|
||||
#define RES_alog_bark36 0xc40 // (3136)
|
||||
#define RES_alog_bark37 0xc41 // (3137)
|
||||
#define RES_alog_bark38 0xc42 // (3138)
|
||||
#define RES_alog_bark39 0xc43 // (3139)
|
||||
#define RES_alog_bark40 0xc44 // (3140)
|
||||
#define RES_alog_bark41 0xc45 // (3141)
|
||||
#define RES_alog_bark42 0xc46 // (3142)
|
||||
#define RES_alog_bark43 0xc47 // (3143)
|
||||
#define RES_alog_bark44 0xc48 // (3144)
|
||||
#define RES_alog_bark45 0xc49 // (3145)
|
||||
#define RES_alog_bark46 0xc4a // (3146)
|
||||
#define RES_alog_bark47 0xc4b // (3147)
|
||||
#define RES_alog_bark48 0xc4c // (3148)
|
||||
#define RES_alog_bark49 0xc4d // (3149)
|
||||
#define RES_alog_bark50 0xc4e // (3150)
|
||||
#define RES_alog_bark51 0xc4f // (3151)
|
||||
#define RES_alog_bark52 0xc50 // (3152)
|
||||
#define RES_alog_bark53 0xc51 // (3153)
|
||||
#define RES_alog_bark54 0xc52 // (3154)
|
||||
#define RES_alog_bark55 0xc53 // (3155)
|
||||
#define RES_alog_bark56 0xc54 // (3156)
|
||||
#define RES_alog_bark57 0xc55 // (3157)
|
||||
#define RES_alog_bark58 0xc56 // (3158)
|
||||
#define RES_alog_bark59 0xc57 // (3159)
|
||||
#define RES_alog_bark60 0xc58 // (3160)
|
||||
#define RES_alog_bark61 0xc59 // (3161)
|
||||
#define RES_alog_bark62 0xc5a // (3162)
|
||||
#define RES_alog_bark63 0xc5b // (3163)
|
||||
#define RES_alog_bark64 0xc5c // (3164)
|
||||
#define RES_alog_bark65 0xc5d // (3165)
|
||||
#define RES_alog_bark66 0xc5e // (3166)
|
||||
#define RES_alog_bark67 0xc5f // (3167)
|
||||
#define RES_alog_bark68 0xc60 // (3168)
|
||||
#define RES_alog_bark69 0xc61 // (3169)
|
||||
#define RES_alog_bark70 0xc62 // (3170)
|
||||
#define RES_alog_bark71 0xc63 // (3171)
|
||||
#define RES_alog_bark72 0xc64 // (3172)
|
||||
#define RES_alog_bark73 0xc65 // (3173)
|
||||
#define RES_alog_bark74 0xc66 // (3174)
|
||||
#define RES_alog_bark75 0xc67 // (3175)
|
||||
#define RES_alog_bark76 0xc68 // (3176)
|
||||
#define RES_alog_bark77 0xc69 // (3177)
|
||||
#define RES_alog_bark78 0xc6a // (3178)
|
||||
#define RES_alog_bark79 0xc6b // (3179)
|
||||
#define RES_alog_bark80 0xc6c // (3180)
|
||||
#define RES_alog_bark81 0xc6d // (3181)
|
||||
#define RES_alog_bark82 0xc6e // (3182)
|
||||
#define RES_alog_bark83 0xc6f // (3183)
|
||||
#define RES_alog_bark84 0xc70 // (3184)
|
||||
#define RES_alog_bark85 0xc71 // (3185)
|
||||
#define RES_alog_bark86 0xc72 // (3186)
|
||||
#define RES_alog_bark87 0xc73 // (3187)
|
||||
#define RES_alog_bark88 0xc74 // (3188)
|
||||
#define RES_alog_bark89 0xc75 // (3189)
|
||||
#define RES_alog_bark90 0xc76 // (3190)
|
||||
#define RES_alog_bark91 0xc77 // (3191)
|
||||
#define RES_alog_bark92 0xc78 // (3192)
|
||||
#define RES_alog_bark93 0xc79 // (3193)
|
||||
#define RES_alog_bark94 0xc7a // (3194)
|
||||
#define RES_alog_bark95 0xc7b // (3195)
|
||||
#define RES_alog_bark96 0xc7c // (3196)
|
||||
#define RES_alog_bark97 0xc7d // (3197)
|
||||
#define RES_alog_bark98 0xc7e // (3198)
|
||||
#define RES_alog_bark99 0xc7f // (3199)
|
||||
#define RES_alog_bark100 0xc80 // (3200)
|
||||
#define RES_alog_bark101 0xc81 // (3201)
|
||||
#define RES_alog_bark102 0xc82 // (3202)
|
||||
#define RES_alog_bark103 0xc83 // (3203)
|
||||
#define RES_alog_bark104 0xc84 // (3204)
|
||||
#define RES_alog_bark105 0xc85 // (3205)
|
||||
#define RES_alog_bark106 0xc86 // (3206)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/* This file created by RESTOOL */
|
||||
|
||||
#ifndef __CITMAT_H
|
||||
#define __CITMAT_H
|
||||
|
||||
#define RES_smallTextureMaps 0x141 // (321)
|
||||
#define RES_materialMaps 0x1db // (475)
|
||||
#define RES_customTextureMaps 0x884 // (2180)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __CITRES_H
|
||||
#define __CITRES_H
|
||||
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/citres.h $
|
||||
* $Revision: 1.8 $
|
||||
* $Author: mahk $
|
||||
* $Date: 1994/09/01 18:31:03 $
|
||||
*
|
||||
*/
|
||||
|
||||
// Includes
|
||||
|
||||
// Defines
|
||||
|
||||
// Typedefs
|
||||
|
||||
// Prototypes
|
||||
#define lock_bitmap_from_ref(r) lock_bitmap_from_ref_anchor(r, NULL)
|
||||
grs_bitmap *lock_bitmap_from_ref_anchor(Ref r, LGRect *anchor);
|
||||
#define get_bitmap_from_ref(r) get_bitmap_from_ref_anchor(r, NULL)
|
||||
grs_bitmap *get_bitmap_from_ref_anchor(Ref r, LGRect *anchor);
|
||||
errtype load_bitmap_from_res(grs_bitmap *bmp, Id id_num, int i, uchar transp, LGRect *anchor);
|
||||
|
||||
// loads in a bitmap or a bitmap cursor, malloc'ing the bits
|
||||
// field.
|
||||
errtype simple_load_res_bitmap(grs_bitmap *bmp, Ref rid);
|
||||
errtype simple_load_res_bitmap_cursor(LGCursor *c, grs_bitmap *bmp, Ref rid);
|
||||
|
||||
// loads a bitmap, specifying whether to malloc the bits or not.
|
||||
errtype load_res_bitmap(grs_bitmap *bmp, Ref rid, uchar alloc);
|
||||
errtype load_res_bitmap_cursor(LGCursor *c, grs_bitmap *bmp, Ref rid, uchar alloc);
|
||||
errtype load_hires_bitmap_cursor(LGCursor *c, grs_bitmap *bmp, Ref rid, uchar alloc);
|
||||
|
||||
// Globals
|
||||
|
||||
#endif // __CITRES_H
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __COLORS_H
|
||||
#define __COLORS_H
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/colors.h $
|
||||
* $Revision: 1.3 $
|
||||
* $Author: dc $
|
||||
* $Date: 1993/10/18 03:28:38 $
|
||||
*/
|
||||
|
||||
// Color defines for the Citadel Palette
|
||||
|
||||
#define PURPLE_BASE 0x20
|
||||
#define TAN_BASE 0x29
|
||||
#define RED_BASE 0x30
|
||||
#define ORANGE_YELLOW_BASE 0x3d
|
||||
#define GREEN_YELLOW_BASE 0x4b
|
||||
#define GREEN_BASE 0x58
|
||||
#define TURQUOISE_BASE 0x65
|
||||
#define BLUE_BASE 0x70
|
||||
#define RED_BROWN_BASE 0x7f
|
||||
#define BROWN_BASE 0x83
|
||||
#define TAN_GRAY_BASE 0xc0
|
||||
#define GRAY_BASE 0xd0
|
||||
#define BLACK 0x00
|
||||
#define WHITE 0x02
|
||||
|
||||
#endif // __COLORS_H
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __COMBAT_H
|
||||
#define __COMBAT_H
|
||||
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/combat.h $
|
||||
* $Revision: 1.21 $
|
||||
* $Author: minman $
|
||||
* $Date: 1994/07/21 01:45:51 $
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// Includes
|
||||
#include "objects.h"
|
||||
|
||||
#define RAYCAST_ATTACK_SIZE (fix_make(0, 0x0400))
|
||||
#define NO_RAYCAST_KICKBACK_SPEED (fix_make(0, 0x0100))
|
||||
|
||||
// all temporary stuff
|
||||
typedef struct {
|
||||
fix x;
|
||||
fix y;
|
||||
fix z;
|
||||
} Combat_Pt;
|
||||
|
||||
typedef struct {
|
||||
fix dx;
|
||||
fix dy;
|
||||
fix dz;
|
||||
Combat_Pt origin;
|
||||
fix mass;
|
||||
fix size;
|
||||
fix speed;
|
||||
fix range;
|
||||
physics_handle exclusion;
|
||||
} Combat_Ray;
|
||||
|
||||
// ******* RAYCAST FUNCTIONS *************
|
||||
// the following ray_cast_* functions do the same thing, but allow for different types of input
|
||||
// returns the first object hit, and returns OBJ_NULL, if ray does not hit any object
|
||||
|
||||
// does a ray cast from object src to the ObjLoc dest
|
||||
ObjID ray_cast_attack(ObjID src, ObjLoc dest, fix bullet_mass, fix bullet_size, fix bullet_speed, fix bullet_range);
|
||||
|
||||
// does a ray cast between point src to point dest
|
||||
ObjID ray_cast_points(ObjID exclusion, Combat_Pt src, Combat_Pt dest, fix bullet_mass, fix bullet_size,
|
||||
fix bullet_speed, fix bullet_range);
|
||||
|
||||
// does a ray cast from point src in the direction of vector
|
||||
// returns hit location at src
|
||||
ObjID ray_cast_vector(ObjID exclusion, Combat_Pt *src, Combat_Pt vector, fix bullet_mass, fix bullet_size,
|
||||
fix bullet_speed, fix bullet_range);
|
||||
|
||||
// does a ray cast from object src to object dest
|
||||
ObjID ray_cast_objects(ObjID src, ObjID dest, fix bullet_mass, fix bullet_size, fix bullet_speed, fix bullet_range);
|
||||
|
||||
// given the point on the 3d view window, returns the vector in that direction to
|
||||
// be used for ray_tracing
|
||||
void find_fire_vector(LGPoint *pt, Combat_Pt *vector);
|
||||
|
||||
#endif // __COMBAT_H
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __CONE_H
|
||||
#define __CONE_H
|
||||
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/cone.h $
|
||||
* $Revision: 1.8 $
|
||||
* $Author: dc $
|
||||
* $Date: 1994/01/02 17:15:58 $
|
||||
*
|
||||
* $Log: cone.h $
|
||||
* Revision 1.8 1994/01/02 17:15:58 dc
|
||||
* indoor terrain renderer
|
||||
*
|
||||
* Revision 1.7 1993/11/16 16:26:05 minman
|
||||
* got rid of testing prototypes so there's not
|
||||
* a depnedency on this file from menus.c
|
||||
*
|
||||
* Revision 1.6 1993/11/16 16:22:43 minman
|
||||
* redid find_view_area prototype
|
||||
*
|
||||
* Revision 1.5 1993/10/19 19:40:08 minman
|
||||
* added simple_cone_clip_pass
|
||||
*
|
||||
* Revision 1.4 1993/09/02 23:07:14 xemu
|
||||
* angle me baby
|
||||
*
|
||||
* Revision 1.3 1993/07/01 01:03:52 minman
|
||||
* added cone test
|
||||
*
|
||||
* Revision 1.2 1993/06/24 01:58:49 minman
|
||||
* find_view_area takes a radius argument now
|
||||
*
|
||||
* Revision 1.1 1993/06/17 20:13:19 minman
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// Includes
|
||||
|
||||
// finds the view area polygon - modifies first argument to become
|
||||
// an array of fix points that represents the view area
|
||||
// polygon is in clockwise order
|
||||
// x,y order - *count is the number of points in the polygon.
|
||||
// return TRUE if it's a valid polygon (not one or two points)
|
||||
|
||||
uchar find_view_area(fix *cone_list, fix fix_floor, fix fix_roof, int *count, fix radius);
|
||||
|
||||
// run the cone clip and render it.
|
||||
void simple_cone_clip_pass(void);
|
||||
|
||||
extern fix span_lines[8];
|
||||
extern byte span_index[2];
|
||||
extern fix span_intersect[4];
|
||||
|
||||
#endif // __CONE_H
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __CRITERR_H
|
||||
#define __CRITERR_H
|
||||
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/criterr.h $
|
||||
* $Revision: 1.3 $
|
||||
* $Author: xemu $
|
||||
* $Date: 1994/05/26 17:20:11 $
|
||||
*
|
||||
*/
|
||||
|
||||
// Defines
|
||||
#define CRITERR_CLASSES 16
|
||||
#define CRITERR_CODES 0x10000
|
||||
|
||||
#define CRITERR_CFG 0x1000 // config errors
|
||||
#define CRITERR_RES 0x2000 // Resource errors
|
||||
#define CRITERR_MEM 0x3000 // Out of memory
|
||||
#define CRITERR_FILE 0x4000 // Misc file error
|
||||
#define CRITERR_EXEC 0x5000 // execution error
|
||||
#define CRITERR_MISC 0xF000 // miscellaneous/glitches
|
||||
#define CRITERR_TEST 0x0000 // Test code
|
||||
|
||||
#define NO_CRITICAL_ERROR 0x0000
|
||||
|
||||
// Prototypes
|
||||
void criterr_init(void);
|
||||
// Initializes critical error system.
|
||||
|
||||
void critical_error(unsigned short code);
|
||||
// Exits the program with error status, printing
|
||||
// the error string for the specified code.
|
||||
|
||||
#endif // __CRITERR_H
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
#ifndef __CUTSLOOP_H
|
||||
#define __CUTSLOOP_H
|
||||
|
||||
// Includes
|
||||
|
||||
// C Library Includes
|
||||
|
||||
// System Library Includes
|
||||
|
||||
// Master Game Includes
|
||||
|
||||
// Game Library Includes
|
||||
|
||||
// Game Object Includes
|
||||
|
||||
// Defines
|
||||
|
||||
// CC: These are all wrong, should find the right resource IDs
|
||||
#define START_CUTSCENE 0
|
||||
#define DEATH_CUTSCENE 1
|
||||
#define WIN_CUTSCENE 2
|
||||
#define ENDGAME_CUTSCENE 3
|
||||
|
||||
// Prototypes
|
||||
|
||||
void cutscene_loop(void);
|
||||
void cutscene_start(void);
|
||||
void cutscene_exit(void);
|
||||
short play_cutscene(int id, bool show_credits);
|
||||
|
||||
// Globals
|
||||
|
||||
#endif // __CUTSLOOP_H
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "player.h"
|
||||
|
||||
errtype exit_cyberspace_stuff();
|
||||
errtype enter_cyberspace_stuff(char dest_level);
|
||||
errtype early_exit_cyberspace_stuff();
|
||||
errtype check_cspace_death();
|
||||
|
||||
#define NUM_CS_EFFECTS 3
|
||||
|
||||
#define CS_TURBO_EFF 0
|
||||
#define CS_DECOY_EFF 1
|
||||
#define CS_MATCHBOX_EFF 2
|
||||
|
||||
#define CYBER_DIFF (player_struct.difficulty[CYBER_DIFF_INDEX])
|
||||
|
||||
//#define BASE_CSPACE_TIME ((CYBER_DIFF == 0) ? (CIT_CYCLE * 3600) : ((CYBER_DIFF == 1) ? (CIT_CYCLE * 720) :
|
||||
//(CIT_CYCLE * 360)))
|
||||
#define BASE_CSPACE_TIME 1800 * CIT_CYCLE
|
||||
|
||||
#define CSPACE_MIN_TIME (CYBER_DIFF ? CIT_CYCLE * 90 : BASE_CSPACE_TIME)
|
||||
#define CSPACE_MAX_TIME \
|
||||
((CYBER_DIFF == 0) ? BASE_CSPACE_TIME \
|
||||
: (CYBER_DIFF == 1) ? (BASE_CSPACE_TIME / 3) \
|
||||
: (CYBER_DIFF == 2) ? (BASE_CSPACE_TIME / 6) : (BASE_CSPACE_TIME / 12))
|
||||
|
||||
// no time penalties at diff 0 and 1, harsh ones at 3
|
||||
#define CSPACE_EXIT_PENALTY ((CYBER_DIFF <= 2) ? 0 : (CIT_CYCLE * 5))
|
||||
#define CSPACE_DEATH_PENALTY ((CYBER_DIFF < 2) ? 0 : ((CYBER_DIFF == 2) ? (CIT_CYCLE * 3) : (CIT_CYCLE * 12)))
|
||||
#define CSPACE_MUX_BONUS CIT_CYCLE * 30
|
||||
|
||||
#define CYBERMINE_DAMAGE 15
|
||||
#define CYBERHEAL_QUANTITY 70
|
||||
|
||||
// Time until SHODAN appears to kick the player out of cyberspace.
|
||||
extern uint32_t time_until_shodan_avatar;
|
||||
|
||||
extern void (*cspace_effect_turnoff[])(uchar, uchar);
|
||||
extern ulong cspace_effect_times[NUM_CS_EFFECTS];
|
||||
extern ulong cspace_effect_durations[NUM_CS_EFFECTS];
|
||||
extern ObjID cspace_decoy_obj;
|
||||
extern ObjLoc recall_objloc;
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CYBERMFD_H
|
||||
#define CYBERMFD_H
|
||||
|
||||
#include "mfdint.h"
|
||||
|
||||
// The cyberspace MFD
|
||||
void mfd_cspace_expose(MFD *mfd, ubyte control);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __CYBMEM_H
|
||||
#define __CYBMEM_H
|
||||
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/cybmem.h $
|
||||
* $Revision: 1.23 $
|
||||
* $Author: xemu $
|
||||
* $Date: 1994/11/01 09:19:29 $
|
||||
*
|
||||
*/
|
||||
|
||||
// Defines
|
||||
|
||||
// Typedefs
|
||||
|
||||
// Prototypes
|
||||
errtype load_dynamic_memory(int mask);
|
||||
errtype free_dynamic_memory(int mask);
|
||||
int avail_memory(int debug_src);
|
||||
void Memory_Check();
|
||||
int slorkatron_memory_check();
|
||||
int flush_resource_cache(void);
|
||||
|
||||
// If LZW stuff ever gets lots more efficient, may need to raise this up some.
|
||||
#define BIG_BUFFER_SIZE (LZW_BUFF_SIZE + 3)
|
||||
|
||||
#define MINIMUM_GAME_THRESHOLD 540000 // this will be tweaked as appropriate...
|
||||
#define BIG_CACHE_THRESHOLD MINIMUM_GAME_THRESHOLD + 1900000
|
||||
|
||||
#define EXTRA_TMAP_THRESHOLD BIG_CACHE_THRESHOLD
|
||||
|
||||
#define BLEND_THRESHOLD EXTRA_TMAP_THRESHOLD + 64000
|
||||
#define BIG_HACKCAM_THRESHOLD BLEND_THRESHOLD + 32000
|
||||
|
||||
#define PRELOAD_ANIMATION_THRESHOLD EXTRA_TMAP_THRESHOLD // for simplicity, can be set different if we are psyched
|
||||
|
||||
// Globals
|
||||
#ifdef __CYBMEM_SRC
|
||||
uchar big_buffer[BIG_BUFFER_SIZE + 16384];
|
||||
int start_mem;
|
||||
#else
|
||||
extern uchar big_buffer[BIG_BUFFER_SIZE + 16384];
|
||||
extern int start_mem;
|
||||
#endif
|
||||
|
||||
#endif // __CYBMEM_H
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __CYBRLOOP_H
|
||||
#define __CYBRLOOP_H
|
||||
|
||||
/*
|
||||
* $Source: q:/inc/RCS/cybrloop.h $
|
||||
* $Revision: 1.2 $
|
||||
* $Author: xemu $
|
||||
* $Date: 1993/09/02 23:07:25 $
|
||||
*
|
||||
* $Log: cybrloop.h $
|
||||
* Revision 1.2 1993/09/02 23:07:25 xemu
|
||||
* angle me baby
|
||||
*
|
||||
* Revision 1.1 1993/05/14 15:46:51 xemu
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// Includes
|
||||
|
||||
// C Library Includes
|
||||
|
||||
// System Library Includes
|
||||
|
||||
// Master Game Includes
|
||||
|
||||
// Game Library Includes
|
||||
|
||||
// Game Object Includes
|
||||
|
||||
// Defines
|
||||
#define CL_VITALS_UPDATE 0
|
||||
#define CL_MFD_UPDATE 1
|
||||
|
||||
// Prototypes
|
||||
void cyber_loop(void);
|
||||
|
||||
// Globals
|
||||
|
||||
#endif // __CYBRLOOP_H
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __CYBRND_H
|
||||
#define __CYBRND_H
|
||||
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/cybrnd.h $
|
||||
* $Revision: 1.5 $
|
||||
* $Author: minman $
|
||||
* $Date: 1993/12/15 22:56:25 $
|
||||
*
|
||||
* $Log: cybrnd.h $
|
||||
* Revision 1.5 1993/12/15 22:56:25 minman
|
||||
* added effect random var
|
||||
*
|
||||
* Revision 1.4 1993/09/02 23:07:26 xemu
|
||||
* angle me baby
|
||||
*
|
||||
* Revision 1.3 1993/08/17 14:17:55 minman
|
||||
* added make-info random number
|
||||
*
|
||||
* Revision 1.2 1993/08/12 19:45:06 minman
|
||||
* added grenade random no
|
||||
*
|
||||
* Revision 1.1 1993/08/12 19:22:58 minman
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
#ifdef __CYBRND_SRC
|
||||
RNDSTREAM_STD(damage_rnd);
|
||||
RNDSTREAM_STD(grenade_rnd);
|
||||
RNDSTREAM_STD(obj_make_rnd);
|
||||
RNDSTREAM_STD(effect_rnd);
|
||||
#else
|
||||
extern RndStream damage_rnd;
|
||||
extern RndStream grenade_rnd;
|
||||
extern RndStream obj_make_rnd;
|
||||
extern RndStream effect_rnd;
|
||||
#endif
|
||||
|
||||
// so i feel like using prime numbers - got a problem with that????
|
||||
#define DAMAGE_SEED 23
|
||||
#define GRENADE_SEED 31
|
||||
#define OBJMAKE_SEED 29
|
||||
#define EFFECT_SEED 37
|
||||
|
||||
void rnd_init(void);
|
||||
|
||||
#endif // __CYBRND_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/damage.h $
|
||||
* $Revision: 1.34 $
|
||||
* $Author: minman $
|
||||
* $Date: 1994/08/09 04:46:01 $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DAMAGE_H
|
||||
#define __DAMAGE_H
|
||||
|
||||
// Includes
|
||||
#include "objects.h"
|
||||
#include "combat.h"
|
||||
|
||||
#define EXPLOSION_TYPE 1
|
||||
#define ENERGY_BEAM_TYPE 2
|
||||
#define MAGNETIC_TYPE 3
|
||||
#define RADIATION_TYPE 4
|
||||
|
||||
#define GAS_TYPE 5
|
||||
#define TRANQ_TYPE 6
|
||||
#define NEEDLE_TYPE 7
|
||||
#define BIO_TYPE 8
|
||||
|
||||
#define DAMAGE_TYPE2MASK(n) (1 << ((n) - 1))
|
||||
|
||||
#define DAMAGE_TYPE_FIELD 0x00FF
|
||||
#define PRIMARY_DAMAGE_FIELD 0x0F00
|
||||
#define PRIMARY_DAMAGE(X) (((X) >> 8) & 0xF)
|
||||
#define SUPER_DAMAGE_FIELD 0xF000
|
||||
#define SUPER_DAMAGE(X) (((X) >> 12) & 0xF)
|
||||
|
||||
#define CYBER_EXPLOSION_TYPE 1
|
||||
#define CYBER_PROJECTILE_TYPE 2
|
||||
#define CYBER_DRILL_TYPE 3
|
||||
|
||||
#define EXPLOSION_FLAG (0x01 << (EXPLOSION_TYPE - 1))
|
||||
#define ENERGY_BEAM_FLAG (0x01 << (ENERGY_BEAM_TYPE - 1))
|
||||
#define MAGNETIC_FLAG (0x01 << (MAGNETIC_TYPE - 1))
|
||||
#define RADIATION_FLAG (0x01 << (RADIATION_TYPE - 1))
|
||||
#define GAS_FLAG (0x01 << (GAS_TYPE - 1))
|
||||
#define TRANQ_FLAG (0x01 << (TRANQ_TYPE - 1))
|
||||
#define NEEDLE_FLAG (0x01 << (NEEDLE_TYPE - 1))
|
||||
#define SLEEP_FLAG (0x01 << (SLEEP_TYPE - 1))
|
||||
|
||||
#define CYBER_EXPLOSION_FLAG (0x01 << (CYBER_EXPLOSION_TYPE - 1))
|
||||
#define CYBER_PROJECTILE_FLAG (0x01 << (CYBER_PROJECTILE_TYPE - 1))
|
||||
#define CYBER_DRILL_FLAG (0x01 << (CYBER_DRILL_TYPE - 1))
|
||||
|
||||
#define DAMAGE_MIN 0
|
||||
#define DAMAGE_MAX 4
|
||||
#define DAMAGE_DEGREES 6
|
||||
|
||||
#define DAMAGE_NONE 0
|
||||
#define DAMAGE_LIGHT 1
|
||||
#define DAMAGE_MEDIUM 2
|
||||
#define DAMAGE_SEVERE 3
|
||||
#define DAMAGE_CRITICAL 4
|
||||
#define DAMAGE_INEFFECTIVE 5
|
||||
#define DAMAGE_TRANQ 6
|
||||
#define DAMAGE_STUN 7
|
||||
|
||||
// attack_object flags
|
||||
#define NO_SHIELD_ABSORBTION 0x01 // should the player's shield not absorb damage
|
||||
// default is to absorb
|
||||
#define FLASH_BLOOD 0x02
|
||||
#define STUN_ATTACK 0x04
|
||||
|
||||
#define MAX_DESTROYED_OBJS 100
|
||||
|
||||
extern short destroyed_obj_count;
|
||||
extern ObjID destroyed_ids[MAX_DESTROYED_OBJS];
|
||||
|
||||
#define ADD_DESTROYED_OBJECT(X) (destroyed_ids[destroyed_obj_count++] = X)
|
||||
|
||||
// is_obj_destroyed()
|
||||
// returns TRUE, if object with id, is scheduled for destruction
|
||||
uchar is_obj_destroyed(ObjID id);
|
||||
|
||||
// destroy_destroyed_objects()
|
||||
// destroy all objects that have been scheduled to be destroyed
|
||||
void destroy_destroyed_objects(void);
|
||||
|
||||
// damage_object()
|
||||
// flags - if the low bit is set - then damage is not absorbed by shields
|
||||
// damage_modifier - raw damage value of attack - 0 if attacking player
|
||||
ubyte damage_object(ObjID target_id, int damage, int dtype, ubyte flags);
|
||||
|
||||
int compute_damage(ObjID target, int damage_type, int damage_mod, ubyte offense, ubyte penet, int power_level,
|
||||
ubyte *effect, ubyte *effect_row, ubyte attack_effect_type);
|
||||
|
||||
ubyte object_affect(ObjID target_id, short dtype);
|
||||
|
||||
// simple_damage object just takes some damage and damage type
|
||||
// (and flags) and damages the object if it is vulnerable.
|
||||
|
||||
uchar simple_damage_object(ObjID target, int damage, ubyte dtype, ubyte flags);
|
||||
uchar terrain_damage_object(physics_handle ph, fix raw_damage);
|
||||
uchar special_terrain_hit(ObjID cobjid);
|
||||
|
||||
// attack_object()
|
||||
//
|
||||
// general all purpose attack/damage object
|
||||
// target - the ObjID of the target being attacked
|
||||
// weapon_triple - the triple for the bullet, grenade, or beam gun
|
||||
// flags - see above
|
||||
// power_level - will be ignored for projectile weapons, but used for grenades and beam guns
|
||||
//
|
||||
ubyte attack_object(ObjID target, int damage_type, int damage_mod, ubyte offense, ubyte penet, ubyte flags,
|
||||
int power_level, ubyte *effect_row, ubyte *effect, ubyte attack_effect_type, int *damage_inflicted);
|
||||
|
||||
// player_attack_object
|
||||
//
|
||||
ubyte player_attack_object(ObjID target, int wpn_triple, int power_level, Combat_Pt origin);
|
||||
|
||||
// get an estimate of how damaged we are, with above numerical index
|
||||
int get_damage_estimate(ObjSpecID osid);
|
||||
|
||||
void spew_object_specs(void);
|
||||
uchar test_object_specs(short keycode, ulong context, void *data);
|
||||
uchar damage_player(int damage, ubyte dtype, ubyte flags);
|
||||
uchar kill_player(void);
|
||||
void regenerate_player(void);
|
||||
|
||||
void slow_proj_hit(ObjID id, ObjID victim);
|
||||
|
||||
#endif // __DAMAGE_H
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
// difficulty defines
|
||||
|
||||
#define MISSION_DIFF_QVAR 0xD
|
||||
#define CYBER_DIFF_QVAR 0xE
|
||||
#define COMBAT_DIFF_QVAR 0xF
|
||||
#define PUZZLE_DIFF_QVAR 0x1E
|
||||
|
||||
// 7 hours on mission difficulty 3
|
||||
#define MISSION_3_TICKS CIT_CYCLE * 3600 * 7
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DIGIFX_H
|
||||
#define DIGIFX_H
|
||||
|
||||
int compute_sfx_vol(ushort x1, ushort y1, ushort x2, ushort y2);
|
||||
int compute_sfx_pan(ushort x1, ushort y1, ushort x2, ushort y2, fixang our_ang);
|
||||
|
||||
uchar set_sample_pan_gain(snd_digi_parms *sdp);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
// Here is the high and mighty Dirac Frame header file, courtesy of Mr. Robert Fermier...
|
||||
// ======================================================================================
|
||||
|
||||
// Struct...
|
||||
// ---------
|
||||
typedef struct {
|
||||
|
||||
fix mass, hardness, roughness, gravity;
|
||||
|
||||
fix corners[10][4];
|
||||
|
||||
} Dirac_frame;
|
||||
|
||||
physics_handle EDMS_make_Dirac_frame(Dirac_frame *d, State *s);
|
||||
void EDMS_get_Dirac_frame_viewpoint(physics_handle ph, State *s);
|
||||
void EDMS_set_Dirac_frame_parameters(physics_handle ph, Dirac_frame *d);
|
||||
void EDMS_get_Dirac_frame_parameters(physics_handle ph, Dirac_frame *d);
|
||||
void EDMS_control_Dirac_frame(physics_handle ph, fix forward, fix pitch, fix yaw, fix roll);
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
// at which frame and above the door is considered "open" to physics....
|
||||
#define DOOR_OPEN_FRAME 3
|
||||
|
||||
#define DOOR_CLOSED(id) (objs[(id)].info.current_frame < DOOR_OPEN_FRAME)
|
||||
#define DOOR_REALLY_CLOSED(id) (objs[(id)].info.current_frame == 0)
|
||||
|
||||
#define NEVER_AUTOCLOSE_COOKIE ((ubyte)-1)
|
||||
|
||||
extern uchar check_object_dist(ObjID obj1, ObjID obj2, fix crit);
|
||||
extern uchar door_locked(ObjID);
|
||||
extern uchar door_moving(ObjID, uchar);
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __DRUGS_H
|
||||
#define __DRUGS_H
|
||||
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/drugs.h $
|
||||
* $Revision: 1.11 $
|
||||
* $Author: xemu $
|
||||
* $Date: 1994/05/13 21:11:25 $
|
||||
*
|
||||
* $Log: drugs.h $
|
||||
* Revision 1.11 1994/05/13 21:11:25 xemu
|
||||
* reflex
|
||||
*
|
||||
* Revision 1.10 1994/02/01 04:37:07 mahk
|
||||
* DRUGS !
|
||||
*
|
||||
* Revision 1.9 1993/09/02 23:07:28 xemu
|
||||
* angle me baby
|
||||
*
|
||||
* Revision 1.8 1993/08/11 20:53:43 spaz
|
||||
* Changed drug identifying #define's
|
||||
*
|
||||
* Revision 1.7 1993/07/28 16:57:02 mahk
|
||||
* Added drug2triple & triple2drug
|
||||
*
|
||||
* Revision 1.6 1993/07/26 21:24:47 spaz
|
||||
* moved drug id's to #define's here
|
||||
*
|
||||
* Revision 1.5 1993/07/19 11:39:48 mahk
|
||||
* Added inventory stuff
|
||||
*
|
||||
* Revision 1.4 1993/07/08 13:29:35 spaz
|
||||
* Moved some #define's around.
|
||||
*
|
||||
* Revision 1.3 1993/07/01 19:16:38 spaz
|
||||
* Added constants and prototypes for generic drug.c funcs.
|
||||
*
|
||||
* Revision 1.2 1993/07/01 17:19:37 spaz
|
||||
* Added NUM_DRUGZ #define, and drugs_time[] static array.
|
||||
*
|
||||
* Revision 1.1 1993/07/01 16:26:23 mahk
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// Defines
|
||||
|
||||
#define DRUG_STAMINUP 0
|
||||
#define DRUG_SIGHT 1
|
||||
#define DRUG_LSD 2
|
||||
#define DRUG_MEDIC 3
|
||||
#define DRUG_REFLEX 4
|
||||
#define DRUG_GENIUS 5
|
||||
#define DRUG_DETOX 6
|
||||
|
||||
// Includes
|
||||
|
||||
// C Library Includes
|
||||
|
||||
// System Library Includes
|
||||
|
||||
// Master Game Includes
|
||||
|
||||
// Game Library Includes
|
||||
|
||||
// Game Object Includes
|
||||
|
||||
// Defines
|
||||
|
||||
// Prototypes
|
||||
|
||||
char *get_drug_name(int type, char *buf);
|
||||
void drug_use(int type);
|
||||
void drug_wear_off(int type);
|
||||
void drug_effect(int type);
|
||||
void drugs_update();
|
||||
void drugs_init();
|
||||
void drug_startup(bool visible);
|
||||
void drug_closedown(bool visible);
|
||||
int drug2triple(int type);
|
||||
int triple2drug(int triple);
|
||||
|
||||
// Globals
|
||||
|
||||
#endif // __DRUGS_H
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#define DYNMEM_ALL 0xFFFFFFFF
|
||||
#define DYNMEM_NONE 0x00000000
|
||||
#define DYNMEM_TEXTURES 0x00000001
|
||||
#define DYNMEM_SIDEICONS 0x00000002
|
||||
#define DYNMEM_FHANDLE_1 0x00000004
|
||||
#define DYNMEM_FHANDLE_2 0x00000008
|
||||
#define DYNMEM_FHANDLE_3 0x00000010
|
||||
#define DYNMEM_FHANDLE_4 0x00000020
|
||||
#define DYNMEM_FILEHANDLES DYNMEM_FHANDLE_1 | DYNMEM_FHANDLE_2 | DYNMEM_FHANDLE_3 | DYNMEM_FHANDLE_4
|
||||
#define DYNMEM_PARTIAL DYNMEM_SIDEICONS | DYNMEM_FHANDLE_1 | DYNMEM_FHANDLE_3 | DYNMEM_FHANDLE_4
|
||||
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __EFFECT_H
|
||||
#define __EFFECT_H
|
||||
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/effect.h $
|
||||
* $Revision: 1.35 $
|
||||
* $Author: xemu $
|
||||
* $Date: 1994/11/21 21:05:41 $
|
||||
*
|
||||
*/
|
||||
|
||||
// Includes
|
||||
#include "objects.h"
|
||||
#include "objcrit.h"
|
||||
#include "objgame.h"
|
||||
#include "objwpn.h"
|
||||
|
||||
#define BLOOD_LIGHT 1
|
||||
#define CAMERA_EXPL 2
|
||||
#define TV_EXPL 3
|
||||
#define SMOKE 4
|
||||
#define PLNT_EXPL 5
|
||||
#define BULL_HIT_WALL 6
|
||||
#define BEAM_HIT_WALL 7
|
||||
#define IMPACT 8
|
||||
#define BULLET_ROBOT 9
|
||||
#define BEAM_ROBOT_LT 10
|
||||
#define BEAM_ROBOT_HVY 11
|
||||
#define M_EXPL1 12
|
||||
#define M_EXPL2 13
|
||||
#define M_EXPL3 14
|
||||
#define LG_EXPL 15
|
||||
#define MAG_HIT 16
|
||||
#define STUN_HIT 17
|
||||
#define PLASMA_HIT 18
|
||||
#define SMOKEY_EXPL 19
|
||||
#define CRATE_EXPL 20
|
||||
#define MNTR_EXPL2 21
|
||||
#define GAS_EXPL 22
|
||||
#define EMP_EXPL 23
|
||||
#define CORPSE_HUM_EXPL 24
|
||||
#define CORPSE_ROB_EXPL 25
|
||||
#define EFFECT_NUMS 25
|
||||
|
||||
// should these be here - or is this just for special effects in the 3D??
|
||||
#define SHIELD_HIT_EFFECT 40
|
||||
#define SHIELD_GONE_EFFECT 41
|
||||
#define BODY_HIT_EFFECT 42
|
||||
|
||||
#define CRIT_HIT_NUM 5
|
||||
#define SEVERITIES 2
|
||||
#define AMMO_TYPES 4
|
||||
#define PROJ_TYPE 0
|
||||
#define BEAM_TYPE 1
|
||||
#define HAND_TYPE 2
|
||||
#define GREN_TYPE 3
|
||||
#define NON_CRITTER_EFFECT (CRIT_HIT_NUM - 1)
|
||||
#define SPECIAL_TYPE CRIT_HIT_NUM
|
||||
|
||||
extern ubyte effect_matrix[CRIT_HIT_NUM][AMMO_TYPES][SEVERITIES];
|
||||
|
||||
// info about the destruction of an object
|
||||
// (a) should we play an effect?
|
||||
// (b) should we destroy the object DURING the effect
|
||||
// (c) should we play a sound effect?
|
||||
|
||||
#define EFFECT_VAL(x) ((x)&0x1F)
|
||||
#define DESTROY_SOUND_EFFECT(x) (((x)&0x60) >> 5)
|
||||
#define DESTROY_OBJ_EFFECT(x) ((x)&0x80)
|
||||
|
||||
// these are things about the state of the effects
|
||||
// they are cleverly hidden in the instance data of the effect
|
||||
// in start_frame
|
||||
|
||||
#define EFFECT_LIGHT_FLAG 0x01
|
||||
|
||||
#define EFFECT_LIGHT_MAP_SHIFT 3
|
||||
#define EFFECT_LIGHT_MAP_MASK 0x78
|
||||
#define EFFECT_DESTROY_OBJ_FLAG 0x80
|
||||
|
||||
#define EFFECT_LIGHT_MAP(x) (((x)&EFFECT_LIGHT_MAP_MASK) >> EFFECT_LIGHT_MAP_SHIFT)
|
||||
#define SET_EFFECT_LIGHT_MAP(x, y) (x = (((x) & ~(EFFECT_LIGHT_MAP_MASK)) | (y << EFFECT_LIGHT_MAP_SHIFT)))
|
||||
#define CLEAR_EFFECT_LIGHT_MAP(x) ((x) &= ~(EFFECT_LIGHT_MAP_MASK))
|
||||
|
||||
#define EFFECT_DESTROY_OBJ(x) ((x) & EFFECT_DESTROY_OBJ_FLAG)
|
||||
#define SET_EFFECT_DESTROY_OBJ(x) ((x) |= EFFECT_DESTROY_OBJ_FLAG)
|
||||
#define CLEAR_EFFECT_DESTROY_OBJ(x) ((x) &= ~(EFFECT_DESTROY_OBJ_FLAG))
|
||||
|
||||
#define START_FRAME(x) ((x) & ~(EFFECT_LIGHT_MAP_MASK | EFFECT_DESTROY_OBJ_FLAG))
|
||||
|
||||
// the effect location
|
||||
#define EFFECT_LOC(id) (objs[id].info.make_info & 0x03)
|
||||
#define SET_EFFECT_LOC(id, x) (objs[id].info.make_info &= (~0x03 | x))
|
||||
#define EFFECT_LEFT 01
|
||||
#define EFFECT_RIGHT 02
|
||||
#define EFFECT_CENTER 03
|
||||
|
||||
// the effect number
|
||||
#define EFFECT_NUM(id) ((objs[id].info.make_info & 0x7C) >> 2)
|
||||
#define SET_EFFECT_NUM(id, x) (objs[id].info.make_info &= (~0x7C | (x << 2)))
|
||||
|
||||
// show two effects????????
|
||||
#define EFFECT_DUAL(id) (objs[id].info.make_info & 0x80)
|
||||
#define SET_EFFECT_DUAL(id, x) (objs[id].info.make_info &= (x << 7))
|
||||
|
||||
// frame count
|
||||
#define EFFECT_FRAME(id) ((objCritters[objs[id].specID].mood & 0x70) >> 4)
|
||||
#define SET_EFFECT_FRAME(id, x) (objCritters[objs[id].specID].mood &= (~0x70 | x << 4))
|
||||
|
||||
// height's range is from 1-7 (one being the lowest, 3 the center)
|
||||
#define EFFECT_HEIGHT(id) ((objCritters[objs[id].specID].orders & 0x70) >> 4)
|
||||
#define SET_EFFECT_HEIGHT(id, x) (objCritters[objs[id].specID].orders &= (~0x70 | x << 4))
|
||||
|
||||
// scale's range is from 1-3 (1 being the smallest)
|
||||
#define EFFECT_SCALE(id) \
|
||||
(((objCritters[objs[id].specID].orders & 0x80) >> 6) | ((objCritters[objs[id].specID].mood & 0x80) >> 7))
|
||||
#define SET_EFFECT_SCALE(id, x) \
|
||||
do { \
|
||||
objCritters[objs[id].specID].orders &= (0x7F | ((x & 0x02) << 6)); \
|
||||
objCritters[objs[id].specID].mood &= (0x7F | ((x & 0x01) << 7)); \
|
||||
} while (0);
|
||||
|
||||
#define EFFECT_EIGHTH(id) ((objCritters[objs[id].specID].current_posture & 0xE0) >> 5)
|
||||
#define SET_EFFECT_EIGHTH(id, x) (objCritters[objs[id].specID].current_posture &= (~0xE0 | (x << 5)))
|
||||
|
||||
#define EFFT2TRIP(num) \
|
||||
((num <= NUM_TRANSITORY_ANIMATING) ? (BLOOD1_TRIPLE + num - 1) \
|
||||
: (EXPLOSION1_TRIPLE + num - (NUM_TRANSITORY_ANIMATING + 1)))
|
||||
|
||||
#define OBJ_LOC_TO_LIGHT_LOC(val) ((val + 0x80) >> 8)
|
||||
|
||||
#define CRITTER_LAMP_MASK 0xF0
|
||||
#define CRITTER_LAMP_SHIFT 4
|
||||
#define CRITLIT(id) (objCritters[objs[id].specID].current_posture)
|
||||
|
||||
#define CRITLOCX(id) (objs[id].info.make_info)
|
||||
#define SET_CRITLOCX(id, val) (objs[id].info.make_info = val)
|
||||
#define CRITLOCY(id) (objCritters[objs[id].specID].ai_mode)
|
||||
#define SET_CRITLOCY(id, val) (objCritters[objs[id].specID].ai_mode = val)
|
||||
|
||||
#define CRITTER_LAMP(id) ((CRITLIT(id) & CRITTER_LAMP_MASK) >> CRITTER_LAMP_SHIFT)
|
||||
#define SET_CRITTER_LAMP(id, lval) (CRITLIT(id) = ((CRITLIT(id) & (~CRITTER_LAMP_MASK)) | (lval << CRITTER_LAMP_SHIFT)))
|
||||
#define CLEAR_CRITTER_LAMP(id) (CRITLIT(id) &= (~CRITTER_LAMP_MASK))
|
||||
|
||||
typedef void (*AnimlistCB)(ObjID id, intptr_t user_data);
|
||||
|
||||
// do_special_effect
|
||||
ObjID do_special_effect(ObjID owner, ubyte effect, ubyte start, ObjID obj, short location);
|
||||
ObjID do_special_effect_location(ObjID owner, ubyte effect, ubyte start, ObjLoc *loc, short location);
|
||||
void advance_animations(void);
|
||||
errtype add_obj_to_animlist(ObjID id, uchar repeat, uchar reverse, uchar cycle, short speed, int cb_id, intptr_t user_data,
|
||||
short cbtype);
|
||||
errtype remove_obj_from_animlist(ObjID id);
|
||||
errtype animlist_clear();
|
||||
uchar anim_data_from_id(ObjID id, bool *reverse, bool *cycle);
|
||||
|
||||
#define MAX_ANIMLIST_SIZE 64
|
||||
|
||||
#define ANIMCB_REMOVE 1
|
||||
#define ANIMCB_REPEAT 2
|
||||
#define ANIMCB_CYCLE 3
|
||||
|
||||
#define ANIMFLAG_REPEAT 1
|
||||
#define ANIMFLAG_REVERSE 2
|
||||
#define ANIMFLAG_CYCLE 4
|
||||
|
||||
typedef struct {
|
||||
ObjID id;
|
||||
uchar flags;
|
||||
short cbtype;
|
||||
int callback;
|
||||
intptr_t user_data;
|
||||
short speed;
|
||||
} AnimListing;
|
||||
|
||||
extern short anim_counter;
|
||||
extern AnimListing animlist[MAX_ANIMLIST_SIZE];
|
||||
|
||||
#endif // __EFFECT_H
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef EMAIL_H
|
||||
#define EMAIL_H
|
||||
|
||||
#include "mfdint.h"
|
||||
|
||||
void add_email_handler(LGRegion *r);
|
||||
uchar email_color_func(void *dp, int num);
|
||||
char *email_name_func(void *dp, int num, char *buf);
|
||||
void read_email(Id new_base, int num);
|
||||
void select_email(int num, uchar scr);
|
||||
void set_email_flags(int n);
|
||||
void update_email_ware();
|
||||
void email_page_exit(void);
|
||||
void mfd_emailmug_expose(MFD *mfd, ubyte control);
|
||||
uchar mfd_emailmug_handler(MFD *m, uiEvent *ev);
|
||||
errtype mfd_emailware_init(MFD_Func *f);
|
||||
void mfd_emailware_expose(MFD *mfd, ubyte control);
|
||||
|
||||
void email_turnon(uchar visible, uchar real_start);
|
||||
void email_turnoff(uchar visible, uchar real_stop);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __EMAILBIT_H
|
||||
#define __EMAILBIT_H
|
||||
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/emailbit.h $
|
||||
* $Revision: 1.2 $
|
||||
* $Author: tjs $
|
||||
* $Date: 1994/08/12 21:04:42 $
|
||||
*
|
||||
*/
|
||||
|
||||
// bit masks for the player_struct email inventory
|
||||
|
||||
#define EMAIL_GOT 0x80u // we've got the email
|
||||
#define EMAIL_READ 0x40u // we've read it.
|
||||
#define EMAIL_SEQ 0x3Fu // sequence number of emails from this sender
|
||||
#define EMAIL_SEQ_SHF 0u
|
||||
|
||||
// flavors of data
|
||||
|
||||
#define EMAIL_VER 0
|
||||
#define LOG_VER 1
|
||||
#define DATA_VER 2
|
||||
|
||||
#endif // __EMAILBIT_H
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef FACEOBJ_H_
|
||||
#define FACEOBJ_H_
|
||||
|
||||
void facelet_obj(ObjID cobjid);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __FAKETIME_H
|
||||
#define __FAKETIME_H
|
||||
|
||||
/* total bogosity that saves having to alter 50 source files */
|
||||
/* the non-time-faking parts of faketime + the new improved timer.h */
|
||||
|
||||
#define CIT_CYCLE 280
|
||||
#define CIT_FREQ (TMD_FREQ / CIT_CYCLE)
|
||||
|
||||
#define APPROX_CIT_CYCLE_HZ 256u
|
||||
#define APPROX_CIT_CYCLE_SHFT 8u
|
||||
|
||||
extern volatile uint32_t *tmd_ticks;
|
||||
|
||||
#endif /* !__FAKETIME_H */
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __FATIGUE_H
|
||||
#define __FATIGUE_H
|
||||
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/fatigue.h $
|
||||
* $Revision: 1.1 $
|
||||
* $Author: mahk $
|
||||
* $Date: 1994/05/05 16:57:50 $
|
||||
*
|
||||
*/
|
||||
|
||||
// Defines
|
||||
#define MAX_FATIGUE 10000
|
||||
|
||||
// Prototypes
|
||||
|
||||
// Globals
|
||||
|
||||
#endif // __FATIGUE_H
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __FAUXRINT_H
|
||||
#define __FAUXRINT_H
|
||||
|
||||
#define CFG_REND_TEST "rend_test"
|
||||
|
||||
#define PLAYER_HEIGHT 174
|
||||
|
||||
#define FR_CUR_OBJ_BASE 65
|
||||
|
||||
// axis setup for the zany extra math-o-tron 3d
|
||||
//#define AXIS_ORDER X_AXIS,Z_AXIS,Y_AXIS
|
||||
//#define ANGLE_ORDER ORDER_ZXY
|
||||
|
||||
//#define AXIS_ORDER X_AXIS,-Y_AXIS,Z_AXIS
|
||||
//#define AXIS_ORDER X_AXIS,Y_AXIS,Z_AXIS
|
||||
|
||||
#define AXIS_ORDER AXIS_RIGHT, AXIS_DOWN, AXIS_IN
|
||||
|
||||
#define ANGLE_ORDER ORDER_YXZ
|
||||
#define pitch tx
|
||||
#define bank tz
|
||||
#define head ty
|
||||
#define xaxis gX
|
||||
#define yaxis gY
|
||||
#define zaxis gZ
|
||||
|
||||
// conversions
|
||||
#define build_fix_angle(ang) ((65536 * (ang)) / 360)
|
||||
|
||||
// masks for quadrant/octant free facing check
|
||||
#define FMK_NW (1 << 0)
|
||||
#define FMK_EW (1 << 1)
|
||||
#define FMK_SW (1 << 2)
|
||||
#define FMK_WW (1 << 3)
|
||||
#define FMK_D1 (1 << 4)
|
||||
#define FMK_D3 (1 << 5)
|
||||
#define FMK_D5 (1 << 6)
|
||||
#define FMK_D7 (1 << 7)
|
||||
|
||||
#define MK_O_N (0)
|
||||
#define MK_O_E (1)
|
||||
#define MK_O_S (2)
|
||||
#define MK_O_W (3)
|
||||
|
||||
#define HG_NW (1 << 1)
|
||||
#define HG_NE (1 << 2)
|
||||
#define HG_SE (1 << 3)
|
||||
#define HG_SW (1 << 0)
|
||||
|
||||
#define RNG_MUL 4
|
||||
#define RNG_1 (0 * RNG_MUL)
|
||||
#define RNG_2 (1 * RNG_MUL)
|
||||
#define RNG_3 (2 * RNG_MUL)
|
||||
|
||||
#define BOT_P 0
|
||||
#define TOP_P 2
|
||||
#define BOT_S 0
|
||||
#define TOP_S 1
|
||||
|
||||
#define LEFT_E 0
|
||||
#define RIGHT_E 1
|
||||
|
||||
/* note: 9 is unused
|
||||
*
|
||||
* 1 B 3
|
||||
* 0 2
|
||||
* 8 D A not detected yet
|
||||
* 4 6
|
||||
* 5 C 7
|
||||
*/
|
||||
|
||||
#define QUAD_N_BASE 0
|
||||
#define QUAD_S_BASE 4
|
||||
#define QUAD_A_BASE 8
|
||||
#define QUAD_X_OFF 2
|
||||
#define QUAD_D_OFF 1
|
||||
#define QUAD_CENTER 0xB
|
||||
|
||||
#define FACE_FLOOR 0
|
||||
#define FACE_CEIL 1
|
||||
#define FACE_WALLS 2
|
||||
|
||||
#define REND_BT_N (1 << 0)
|
||||
#define REND_BT_E (1 << 1)
|
||||
#define REND_BT_S (1 << 2)
|
||||
#define REND_BT_W (1 << 3)
|
||||
|
||||
#define REND_BT_FLR (1 << 4)
|
||||
#define REND_BT_CIE (1 << 5)
|
||||
#define REND_BT_INT (1 << 6)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2020 Shockolate Project
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef FIXTRMFD_H
|
||||
#define FIXTRMFD_H
|
||||
|
||||
// ----------
|
||||
// PROTOTYPES
|
||||
// ----------
|
||||
void mfd_fixture_expose(MFD *mfd, ubyte control);
|
||||
uchar mfd_fixture_handler(MFD *m, uiEvent *e);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
* $Source: n:/project/cit/src/inc/RCS/fr3d.h $
|
||||
* $Revision: 1.2 $
|
||||
* $Author: dc $
|
||||
* $Date: 1994/06/01 22:50:23 $
|
||||
*
|
||||
* Citadel Renderer
|
||||
* setup and stuff for point counts, initialization, and so on
|
||||
*/
|
||||
|
||||
//#define FR_PT_CNT 1024
|
||||
#define FR_PT_CNT 256
|
||||
#define FR_DEF_FOV 80
|
||||
#define FR_DEF_AXIS 'X'
|
||||
|
||||
#define AXIS_ORDER AXIS_RIGHT, AXIS_DOWN, AXIS_IN
|
||||
|
||||
#define ANGLE_ORDER ORDER_YXZ
|
||||
#define pitch tx
|
||||
#define bank tz
|
||||
#define head ty
|
||||
#define xaxis gX
|
||||
#define yaxis gY
|
||||
#define zaxis gZ
|
||||
|
||||
// conversions
|
||||
// does anyone ever call this... oh yea, for matts stuff...
|
||||
// ick
|
||||
#define build_fix_angle(ang) ((65536 * (ang)) / 360)
|
||||
|
||||
// coordinate merge - have to inc frcamera.h to use these
|
||||
#define coor(val) (fr_camera_last[val])
|
||||
#define ang(val) (fr_camera_last[val])
|
||||
#define last_coor(val) (fr_camera_last[val])
|
||||
#define last_ang(val) (fr_camera_last[val])
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef __FRAMER8_H
|
||||
#define __FRAMER8_H
|
||||
|
||||
/*
|
||||
* $Source: r:/prj/cit/src/inc/RCS/framer8.h $
|
||||
* $Revision: 1.1 $
|
||||
* $Author: mahk $
|
||||
* $Date: 1994/09/06 00:11:53 $
|
||||
*
|
||||
*/
|
||||
|
||||
#define MIN_FRAME_RATE 6
|
||||
#define MAX_FRAME_RATE 70
|
||||
|
||||
#endif // __FRAMER8_H
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2015-2018 Night Dive Studios, LLC.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
* FrCamera.h
|
||||
*
|
||||
* $Source: n:/project/cit/src/inc/RCS/frcamera.h $
|
||||
* $Revision: 1.6 $
|
||||
* $Author: dc $
|
||||
* $Date: 1994/04/10 05:16:16 $
|
||||
*
|
||||
* Citadel Renderer
|
||||
* camera position/modification/creation system
|
||||
*
|
||||
* $Log: frcamera.h $
|
||||
* Revision 1.6 1994/04/10 05:16:16 dc
|
||||
* support for cyberman, vfx1, other 6d control structure, inc. HEAD_H
|
||||
*
|
||||
* Revision 1.5 1994/01/31 05:37:27 dc
|
||||
* yea yea yea
|
||||
*
|
||||
* Revision 1.4 1994/01/02 17:16:19 dc
|
||||
* Initial revision
|
||||
*
|
||||
* Revision 1.3 1993/09/17 17:00:31 mahk
|
||||
* Added 360 support
|
||||
*
|
||||
* Revision 1.2 1993/09/16 23:55:06 dc
|
||||
* support for fr internal camera view changing
|
||||
*
|
||||
* Revision 1.1 1993/09/05 20:58:57 dc
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __FRCAMERA_H
|
||||
#define __FRCAMERA_H
|
||||
|
||||
#define CAM_COOR_CNT 6
|
||||
#define CAM_ARGS_CNT 3
|
||||
|
||||
typedef struct {
|
||||
uchar type; // camera type code
|
||||
ushort obj_id; // current obj_id, or null if abs used
|
||||
fix coor[CAM_COOR_CNT]; // current abs pos
|
||||
fix args[CAM_ARGS_CNT]; // args interpreted based on type
|
||||
} cams;
|
||||
|
||||
uchar fr_camera_create(cams *cam, int camtype, ushort oid, fix *coor, fix *args);
|
||||
uchar fr_camera_modtype(cams *cam, uchar type_on, uchar type_off);
|
||||
int fr_camera_update(cams *cam, uintptr_t arg1, int whicharg, uintptr_t arg2);
|
||||
void fr_camera_slewone(cams *cam, int which, int how);
|
||||
void fr_camera_setone(cams *cam, int which, int newCam);
|
||||
fix *fr_camera_getpos(cams *cam);
|
||||
void fr_camera_slewcam(cams *cam, int which, int how);
|
||||
cams *fr_camera_getdef(void);
|
||||
void fr_camera_setdef(cams *cam);
|
||||
void fr_camera_getobjloc(int oid, fix *store);
|
||||
|
||||
extern fix cam_slew_scale[CAM_COOR_CNT];
|
||||
extern fix fr_camera_last[CAM_COOR_CNT];
|
||||
|
||||
// cameras are now 8 bit flags
|
||||
// 1 mods, 1 flt, 2 ang, 2 off, 1 obj
|
||||
//
|
||||
//
|
||||
|
||||
#define CAMOBJ_S 0u
|
||||
#define CAMOBJ_Z 1u
|
||||
#define CAMOFF_S (CAMOBJ_S + CAMOBJ_Z)
|
||||
#define CAMOFF_Z 2u
|
||||
#define CAMANG_S (CAMOFF_S + CAMOFF_Z)
|
||||
#define CAMANG_Z 2u
|
||||
#define CAMFLT_S (CAMANG_S + CAMANG_Z)
|
||||
#define CAMFLT_Z 1u
|
||||
#define CAMMOD_S (CAMFLT_S + CAMFLT_Z)
|
||||
#define CAMMOD_Z 1u
|
||||
|
||||
//#define MakeCambit(x) CAMBIT_##x## (((1<<CAM##x##_Z)-1)<<CAM##x##_S)
|
||||
//#define MakeCambit(OBJ)
|
||||
//#define MakeCambit(OFF)
|
||||
//#define MakeCambit(ANG)
|
||||
|
||||
#define CAMBIT_OBJ (((1 << CAMOBJ_Z) - 1) << CAMOBJ_S)
|
||||
#define CAMBIT_OFF (((1 << CAMOFF_Z) - 1) << CAMOFF_S)
|
||||
#define CAMBIT_ANG (((1 << CAMANG_Z) - 1) << CAMANG_S)
|
||||
#define CAMBIT_FLT (((1 << CAMFLT_Z) - 1) << CAMFLT_S)
|
||||
#define CAMBIT_MOD (((1 << CAMMOD_Z) - 1) << CAMMOD_S)
|
||||
|
||||
#define CAMANG_STRAIGHT (0u << CAMANG_S)
|
||||
#define CAMANG_LEFT (1u << CAMANG_S)
|
||||
#define CAMANG_BACK (2u << CAMANG_S)
|
||||
#define CAMANG_RIGHT (3u << CAMANG_S)
|
||||
|
||||
#define CAMOFF_NORM (0 << CAMOFF_S)
|
||||
#define CAMOFF_ORBIT (1 << CAMOFF_S)
|
||||
#define CAMOFF_SHOULDER (2 << CAMOFF_S)
|
||||
|
||||
#define CAMTYPE_ABS (0 << CAMOBJ_S)
|
||||
#define CAMTYPE_OBJ (1 << CAMOBJ_S)
|
||||
|
||||
#define CAMFLT_FULL3D (0 << CAMFLT_S)
|
||||
#define CAMFLT_FLAT (1 << CAMFLT_S)
|
||||
|
||||
#define CAMMOD_NOMOD (0 << CAMMOD_S)
|
||||
#define CAMMOD_USEMOD (1 << CAMMOD_S)
|
||||
|
||||
#define CAM_UPDATE_ALL (-1)
|
||||
#define CAM_UPDATE_NONE (CAM_COOR_CNT)
|
||||
|
||||
// camera/eyeposition controllers
|
||||
#define EYE_X 0
|
||||
#define EYE_Y 1
|
||||
#define EYE_Z 2
|
||||
#define EYE_H 3
|
||||
#define EYE_P 4
|
||||
#define EYE_B 5
|
||||
#define EYE_RESET 6
|
||||
#define EYE_HEADH 7
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user