mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-26 21:51:04 +00:00
Merge remote-tracking branch 'stjr/next' into patch-refactor
This commit is contained in:
commit
9c758e68e8
90 changed files with 1460 additions and 5315 deletions
|
@ -50,7 +50,7 @@ jobs:
|
||||||
- v1-SRB2-APT
|
- v1-SRB2-APT
|
||||||
- run:
|
- run:
|
||||||
name: Install SDK
|
name: Install SDK
|
||||||
command: apt-get -o Dir::Cache="/root/.cache/apt" -qq -y --no-install-recommends install git build-essential nasm libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libcurl4-openssl-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
|
command: apt-get -o Dir::Cache="/root/.cache/apt" -qq -y --no-install-recommends install git build-essential libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libcurl4-openssl-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
|
||||||
- run:
|
- run:
|
||||||
name: make md5sum
|
name: make md5sum
|
||||||
command: find /root/.cache/apt/archives -type f -print0 | sort -z | xargs -r0 md5sum > /root/.cache/apt_archives.md5
|
command: find /root/.cache/apt/archives -type f -print0 | sort -z | xargs -r0 md5sum > /root/.cache/apt_archives.md5
|
||||||
|
|
|
@ -131,7 +131,11 @@ if("${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
||||||
find_package(SDL2_mixer REQUIRED)
|
find_package(SDL2_mixer REQUIRED)
|
||||||
find_package(CURL REQUIRED)
|
find_package(CURL REQUIRED)
|
||||||
find_package(OPENMPT REQUIRED)
|
find_package(OPENMPT REQUIRED)
|
||||||
find_package(GME REQUIRED)
|
|
||||||
|
# libgme defaults to "Nuked" YM2612 emulator, which is
|
||||||
|
# very SLOW. The system library probably uses the
|
||||||
|
# default so just always build it.
|
||||||
|
#find_package(GME REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
|
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
|
||||||
|
@ -142,13 +146,6 @@ if ((${SRB2_USE_CCACHE}) AND (${CMAKE_C_COMPILER} MATCHES "clang"))
|
||||||
message(WARNING "Using clang and CCache: You may want to set environment variable CCACHE_CPP2=yes to prevent include errors during compile.")
|
message(WARNING "Using clang and CCache: You may want to set environment variable CCACHE_CPP2=yes to prevent include errors during compile.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add sources from Sourcefile
|
|
||||||
function(target_sourcefile type)
|
|
||||||
file(STRINGS Sourcefile list
|
|
||||||
REGEX "[-0-9A-Za-z_]+\.${type}")
|
|
||||||
target_sources(SRB2SDL2 PRIVATE ${list})
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# bitness check
|
# bitness check
|
||||||
set(SRB2_SYSTEM_BITS 0)
|
set(SRB2_SYSTEM_BITS 0)
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
@ -167,7 +164,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||||
set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||||
|
|
||||||
# Set EXE names so the assets CMakeLists can refer to its target
|
# Set EXE names so the assets CMakeLists can refer to its target
|
||||||
set(SRB2_SDL2_EXE_NAME srb2 CACHE STRING "Executable binary output name")
|
set(SRB2_SDL2_EXE_NAME "" CACHE STRING "Override executable binary output name")
|
||||||
|
set(SRB2_SDL2_EXE_SUFFIX "" CACHE STRING "Optional executable suffix, separated by an underscore")
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
|
|
||||||
|
@ -175,11 +173,37 @@ add_subdirectory(src)
|
||||||
add_subdirectory(assets)
|
add_subdirectory(assets)
|
||||||
|
|
||||||
|
|
||||||
## config.h generation
|
|
||||||
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
||||||
include(GitUtilities)
|
include(GitUtilities)
|
||||||
git_latest_commit(SRB2_COMP_COMMIT "${CMAKE_SOURCE_DIR}")
|
|
||||||
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
|
if("${SRB2_SDL2_EXE_NAME}" STREQUAL "")
|
||||||
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
|
# cause a reconfigure if the branch changes
|
||||||
set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
|
get_git_dir(SRB2_GIT_DIR)
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
configure_file("${SRB2_GIT_DIR}/HEAD" HEAD COPYONLY)
|
||||||
|
|
||||||
|
git_current_branch(SRB2_GIT_REVISION)
|
||||||
|
|
||||||
|
if("${SRB2_GIT_REVISION}" STREQUAL "")
|
||||||
|
# use abbreviated commit hash if on detached HEAD
|
||||||
|
git_latest_commit(SRB2_GIT_REVISION)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
||||||
|
list(APPEND EXE_NAME_PARTS "srb2win")
|
||||||
|
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||||
|
list(APPEND EXE_NAME_PARTS "lsdlsrb2")
|
||||||
|
else()
|
||||||
|
list(APPEND EXE_NAME_PARTS "srb2")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT "${SRB2_GIT_REVISION}" STREQUAL "master")
|
||||||
|
list(APPEND EXE_NAME_PARTS ${SRB2_GIT_REVISION})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
list(APPEND EXE_NAME_PARTS ${SRB2_SDL2_EXE_NAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND EXE_NAME_PARTS ${SRB2_SDL2_EXE_SUFFIX})
|
||||||
|
|
||||||
|
list(JOIN EXE_NAME_PARTS "_" EXE_NAME)
|
||||||
|
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${EXE_NAME})
|
||||||
|
|
29
CMakePresets.json
Normal file
29
CMakePresets.json
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"description": "Build using default generator",
|
||||||
|
"binaryDir": "build",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_C_FLAGS": "-fdiagnostics-color",
|
||||||
|
"CMAKE_CXX_FLAGS": "-fdiagnostics-color",
|
||||||
|
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "debug",
|
||||||
|
"description": "Build for development (no optimizations)",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"buildPresets": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"configurePreset": "default"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -8,7 +8,6 @@
|
||||||
[Sonic Robo Blast 2](https://srb2.org/) is a 3D Sonic the Hedgehog fangame based on a modified version of [Doom Legacy](http://doomlegacy.sourceforge.net/).
|
[Sonic Robo Blast 2](https://srb2.org/) is a 3D Sonic the Hedgehog fangame based on a modified version of [Doom Legacy](http://doomlegacy.sourceforge.net/).
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
- NASM (x86 builds only)
|
|
||||||
- SDL2 (Linux/OS X only)
|
- SDL2 (Linux/OS X only)
|
||||||
- SDL2-Mixer (Linux/OS X only)
|
- SDL2-Mixer (Linux/OS X only)
|
||||||
- libupnp (Linux/OS X only)
|
- libupnp (Linux/OS X only)
|
||||||
|
|
18
SRB2.cbp
18
SRB2.cbp
|
@ -1992,24 +1992,6 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Option compilerVar="CC" />
|
<Option compilerVar="CC" />
|
||||||
</Unit>
|
</Unit>
|
||||||
<Unit filename="src/v_video.h" />
|
<Unit filename="src/v_video.h" />
|
||||||
<Unit filename="src/vid_copy.s">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option compiler="avrgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
|
||||||
<Option compiler="gnu_gcc_compiler_for_mingw32" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
|
||||||
<Option compiler="gnu_gcc_compiler_for_mingw64" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
|
||||||
<Option compiler="armelfgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
|
||||||
<Option compiler="tricoregcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
|
||||||
<Option compiler="ppcgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
|
||||||
<Option compiler="gcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Mingw/DirectX" />
|
|
||||||
<Option target="Release Mingw/DirectX" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/w_wad.c">
|
<Unit filename="src/w_wad.c">
|
||||||
<Option compilerVar="CC" />
|
<Option compilerVar="CC" />
|
||||||
</Unit>
|
</Unit>
|
||||||
|
|
|
@ -25,9 +25,6 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(PlatformTarget)'=='x86'">
|
<ItemDefinitionGroup Condition="'$(PlatformTarget)'=='x86'">
|
||||||
<ClCompile>
|
|
||||||
<PreprocessorDefinitions>USEASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
<Link>
|
||||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
52
Srb2.dev
52
Srb2.dev
|
@ -5,7 +5,7 @@ Ver=3
|
||||||
IsCpp=0
|
IsCpp=0
|
||||||
Type=0
|
Type=0
|
||||||
UnitCount=279
|
UnitCount=279
|
||||||
Folders=A_Asm,B_Bot,BLUA,D_Doom,F_Frame,G_Game,H_Hud,Hw_Hardware,Hw_Hardware/r_opengl,I_Interface,I_Interface/Dummy,I_Interface/SDL,I_Interface/Win32,LUA,M_Misc,P_Play,R_Rend,S_Sounds,W_Wad
|
Folders=B_Bot,BLUA,D_Doom,F_Frame,G_Game,H_Hud,Hw_Hardware,Hw_Hardware/r_opengl,I_Interface,I_Interface/Dummy,I_Interface/SDL,I_Interface/Win32,LUA,M_Misc,P_Play,R_Rend,S_Sounds,W_Wad
|
||||||
CommandLine=
|
CommandLine=
|
||||||
CompilerSettings=00000000000100000111e1
|
CompilerSettings=00000000000100000111e1
|
||||||
PchHead=-1
|
PchHead=-1
|
||||||
|
@ -1473,36 +1473,6 @@ Priority=1000
|
||||||
OverrideBuildCmd=0
|
OverrideBuildCmd=0
|
||||||
BuildCmd=
|
BuildCmd=
|
||||||
|
|
||||||
[Unit149]
|
|
||||||
FileName=src\tmap.nas
|
|
||||||
Folder=A_Asm
|
|
||||||
Compile=0
|
|
||||||
CompileCpp=0
|
|
||||||
Link=0
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=1
|
|
||||||
BuildCmd=nasm.exe -g -o $@ -f win32 src/tmap.nas
|
|
||||||
|
|
||||||
[Unit150]
|
|
||||||
FileName=src\asm_defs.inc
|
|
||||||
Folder=A_Asm
|
|
||||||
Compile=0
|
|
||||||
CompileCpp=0
|
|
||||||
Link=0
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=
|
|
||||||
|
|
||||||
[Unit151]
|
|
||||||
FileName=src\vid_copy.s
|
|
||||||
Folder=A_Asm
|
|
||||||
Compile=1
|
|
||||||
CompileCpp=0
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=1
|
|
||||||
BuildCmd=$(CC) $(CFLAGS) -x assembler-with-cpp -c src/vid_copy.s -o $@
|
|
||||||
|
|
||||||
[Unit152]
|
[Unit152]
|
||||||
FileName=src\y_inter.h
|
FileName=src\y_inter.h
|
||||||
Folder=H_Hud
|
Folder=H_Hud
|
||||||
|
@ -1543,26 +1513,6 @@ Priority=1000
|
||||||
OverrideBuildCmd=0
|
OverrideBuildCmd=0
|
||||||
BuildCmd=
|
BuildCmd=
|
||||||
|
|
||||||
[Unit156]
|
|
||||||
FileName=src\p5prof.h
|
|
||||||
Folder=A_Asm
|
|
||||||
Compile=1
|
|
||||||
CompileCpp=0
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=
|
|
||||||
|
|
||||||
[Unit157]
|
|
||||||
FileName=src\tmap_mmx.nas
|
|
||||||
Folder=A_Asm
|
|
||||||
Compile=0
|
|
||||||
CompileCpp=0
|
|
||||||
Link=0
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=1
|
|
||||||
BuildCmd=nasm.exe -g -o $@ -f win32 src/tmap_mmx.nas
|
|
||||||
|
|
||||||
[Unit159]
|
[Unit159]
|
||||||
FileName=src\lzf.h
|
FileName=src\lzf.h
|
||||||
Folder=W_Wad
|
Folder=W_Wad
|
||||||
|
|
29
alias-bootstrap.sh
Executable file
29
alias-bootstrap.sh
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# All these commands can be run from anywhere in the git
|
||||||
|
# tree, not just the top level.
|
||||||
|
|
||||||
|
# Usage: git cmake
|
||||||
|
#
|
||||||
|
# Same usage as standard CMake command.
|
||||||
|
#
|
||||||
|
git config 'alias.cmake' '!cmake'
|
||||||
|
|
||||||
|
# Usage: git build <build preset> [options]
|
||||||
|
# Usage: git build [options]
|
||||||
|
#
|
||||||
|
# In the second usage, when no preset is given, the
|
||||||
|
# "default" build preset is used.
|
||||||
|
#
|
||||||
|
# Available options can be found by running:
|
||||||
|
#
|
||||||
|
# git cmake --build
|
||||||
|
#
|
||||||
|
git config 'alias.build' '!p="${1##-*}"; [ "$p" ] && shift; git cmake --build --preset "${p:-default}"'
|
||||||
|
|
||||||
|
# Usage: git crossmake
|
||||||
|
#
|
||||||
|
# Shortcut to i686-w64-mingw32-cmake (CMake cross
|
||||||
|
# compiler)
|
||||||
|
#
|
||||||
|
git config 'alias.crossmake' '!i686-w64-mingw32-cmake'
|
|
@ -7,8 +7,6 @@ environment:
|
||||||
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
|
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
|
||||||
MINGW_SDK: c:\msys64\mingw32
|
MINGW_SDK: c:\msys64\mingw32
|
||||||
CFLAGS: -Wno-implicit-fallthrough
|
CFLAGS: -Wno-implicit-fallthrough
|
||||||
NASM_ZIP: nasm-2.12.01
|
|
||||||
NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip
|
|
||||||
UPX_ZIP: upx391w
|
UPX_ZIP: upx391w
|
||||||
UPX_URL: http://upx.sourceforge.net/download/upx391w.zip
|
UPX_URL: http://upx.sourceforge.net/download/upx391w.zip
|
||||||
CCACHE_EXE: ccache.exe
|
CCACHE_EXE: ccache.exe
|
||||||
|
@ -40,17 +38,12 @@ environment:
|
||||||
ASSET_CLEAN: 0
|
ASSET_CLEAN: 0
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
- nasm-2.12.01.zip
|
|
||||||
- upx391w.zip
|
- upx391w.zip
|
||||||
- ccache.exe
|
- ccache.exe
|
||||||
- C:\Users\appveyor\.ccache
|
- C:\Users\appveyor\.ccache
|
||||||
- C:\Users\appveyor\srb2_cache
|
- C:\Users\appveyor\srb2_cache
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if not exist "%NASM_ZIP%.zip" appveyor DownloadFile "%NASM_URL%" -FileName "%NASM_ZIP%.zip"
|
|
||||||
- 7z x -y "%NASM_ZIP%.zip" -o%TMP% >null
|
|
||||||
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%NASM_ZIP%" "%MINGW_SDK%\bin" nasm.exe || exit 0
|
|
||||||
|
|
||||||
- if not exist "%UPX_ZIP%.zip" appveyor DownloadFile "%UPX_URL%" -FileName "%UPX_ZIP%.zip"
|
- if not exist "%UPX_ZIP%.zip" appveyor DownloadFile "%UPX_URL%" -FileName "%UPX_ZIP%.zip"
|
||||||
- 7z x -y "%UPX_ZIP%.zip" -o%TMP% >null
|
- 7z x -y "%UPX_ZIP%.zip" -o%TMP% >null
|
||||||
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%UPX_ZIP%" "%MINGW_SDK%\bin" upx.exe || exit 0
|
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%UPX_ZIP%" "%MINGW_SDK%\bin" upx.exe || exit 0
|
||||||
|
@ -65,7 +58,6 @@ configuration:
|
||||||
before_build:
|
before_build:
|
||||||
- set "Path=%MINGW_SDK%\bin;%Path%"
|
- set "Path=%MINGW_SDK%\bin;%Path%"
|
||||||
- mingw32-make --version
|
- mingw32-make --version
|
||||||
- nasm -v
|
|
||||||
- if not [%NOUPX%] == [1] ( upx -V )
|
- if not [%NOUPX%] == [1] ( upx -V )
|
||||||
- ccache -V
|
- ccache -V
|
||||||
- ccache -s
|
- ccache -s
|
||||||
|
|
32
cmake/Comptime.cmake
Normal file
32
cmake/Comptime.cmake
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
|
||||||
|
|
||||||
|
set(CMAKE_BINARY_DIR "${BINARY_DIR}")
|
||||||
|
set(CMAKE_CURRENT_BINARY_DIR "${BINARY_DIR}")
|
||||||
|
|
||||||
|
# Set up CMAKE path
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
|
include(GitUtilities)
|
||||||
|
|
||||||
|
git_current_branch(SRB2_COMP_BRANCH)
|
||||||
|
git_working_tree_dirty(SRB2_COMP_UNCOMMITTED)
|
||||||
|
|
||||||
|
git_latest_commit(SRB2_COMP_REVISION)
|
||||||
|
git_subject(subject)
|
||||||
|
string(REGEX REPLACE "([\"\\])" "\\\\\\1" SRB2_COMP_NOTE "${subject}")
|
||||||
|
|
||||||
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||||
|
set(CMAKE_BUILD_TYPE None)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# These build types enable optimizations of some kind by default.
|
||||||
|
set(optimized_build_types "MINSIZEREL;RELEASE;RELWITHDEBINFO")
|
||||||
|
|
||||||
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
|
||||||
|
if("${build_type}" IN_LIST optimized_build_types)
|
||||||
|
set(SRB2_COMP_OPTIMIZED TRUE)
|
||||||
|
else()
|
||||||
|
set(SRB2_COMP_OPTIMIZED FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/config.h")
|
|
@ -1,46 +0,0 @@
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2010 Kitware, Inc.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
# (To distribute this file outside of CMake, substitute the full
|
|
||||||
# License text for the above reference.)
|
|
||||||
|
|
||||||
# support for the yasm assembler
|
|
||||||
|
|
||||||
set(CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS nasm yasm asm)
|
|
||||||
|
|
||||||
if(NOT CMAKE_ASM_YASM_OBJECT_FORMAT)
|
|
||||||
if(WIN32)
|
|
||||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
|
||||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT win64)
|
|
||||||
else()
|
|
||||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT win32)
|
|
||||||
endif()
|
|
||||||
elseif(APPLE)
|
|
||||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
|
||||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT macho64)
|
|
||||||
else()
|
|
||||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT macho)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
|
||||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT elf64)
|
|
||||||
else()
|
|
||||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT elf)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_ASM_YASM_COMPILE_OBJECT "<CMAKE_ASM_YASM_COMPILER> <FLAGS> -f ${CMAKE_ASM_YASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
|
|
||||||
|
|
||||||
# Load the generic ASMInformation file:
|
|
||||||
set(ASM_DIALECT "_YASM")
|
|
||||||
include(CMakeASMInformation)
|
|
||||||
set(ASM_DIALECT)
|
|
|
@ -1,27 +0,0 @@
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2010 Kitware, Inc.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
# (To distribute this file outside of CMake, substitute the full
|
|
||||||
# License text for the above reference.)
|
|
||||||
|
|
||||||
# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
|
|
||||||
|
|
||||||
set(CMAKE_ASM_YASM_COMPILER_LIST nasm yasm)
|
|
||||||
|
|
||||||
if(NOT CMAKE_ASM_YASM_COMPILER)
|
|
||||||
find_program(CMAKE_ASM_YASM_COMPILER yasm
|
|
||||||
"$ENV{ProgramFiles}/YASM")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Load the generic DetermineASM compiler file with the DIALECT set properly:
|
|
||||||
set(ASM_DIALECT "_YASM")
|
|
||||||
include(CMakeDetermineASMCompiler)
|
|
||||||
set(ASM_DIALECT)
|
|
|
@ -1,23 +0,0 @@
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2010 Kitware, Inc.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
# (To distribute this file outside of CMake, substitute the full
|
|
||||||
# License text for the above reference.)
|
|
||||||
|
|
||||||
# This file is used by EnableLanguage in cmGlobalGenerator to
|
|
||||||
# determine that the selected ASM_NASM "compiler" works.
|
|
||||||
# For assembler this can only check whether the compiler has been found,
|
|
||||||
# because otherwise there would have to be a separate assembler source file
|
|
||||||
# for each assembler on every architecture.
|
|
||||||
|
|
||||||
set(ASM_DIALECT "_YASM")
|
|
||||||
include(CMakeTestASMCompiler)
|
|
||||||
set(ASM_DIALECT)
|
|
|
@ -6,38 +6,54 @@ endif()
|
||||||
|
|
||||||
set(__GitUtilities ON)
|
set(__GitUtilities ON)
|
||||||
|
|
||||||
function(git_describe variable path)
|
macro(_git_command)
|
||||||
execute_process(COMMAND "${GIT_EXECUTABLE}" "describe"
|
execute_process(
|
||||||
WORKING_DIRECTORY "${path}"
|
COMMAND "${GIT_EXECUTABLE}" ${ARGN}
|
||||||
RESULT_VARIABLE result
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
OUTPUT_VARIABLE output
|
OUTPUT_VARIABLE output
|
||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(_git_easy_command)
|
||||||
|
_git_command(${ARGN})
|
||||||
|
set(${variable} "${output}" PARENT_SCOPE)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
function(git_current_branch variable)
|
||||||
|
_git_command(symbolic-ref -q --short HEAD)
|
||||||
|
|
||||||
|
# If a detached head, a ref could still be resolved.
|
||||||
|
if("${output}" STREQUAL "")
|
||||||
|
_git_command(describe --all --exact-match)
|
||||||
|
|
||||||
|
# Get the ref, in the form heads/master or
|
||||||
|
# remotes/origin/master so isolate the final part.
|
||||||
|
string(REGEX REPLACE ".*/" "" output "${output}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(${variable} "${output}" PARENT_SCOPE)
|
set(${variable} "${output}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(git_current_branch variable path)
|
function(git_latest_commit variable)
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} "symbolic-ref" "--short" "HEAD"
|
_git_easy_command(rev-parse --short HEAD)
|
||||||
WORKING_DIRECTORY "${path}"
|
|
||||||
RESULT_VARIABLE result
|
|
||||||
OUTPUT_VARIABLE output
|
|
||||||
ERROR_QUIET
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
|
|
||||||
set(${variable} "${output}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(git_latest_commit variable path)
|
function(git_working_tree_dirty variable)
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} "rev-parse" "--short" "HEAD"
|
_git_command(status --porcelain -uno)
|
||||||
WORKING_DIRECTORY "${path}"
|
|
||||||
RESULT_VARIABLE result
|
|
||||||
OUTPUT_VARIABLE output
|
|
||||||
ERROR_QUIET
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
|
|
||||||
set(${variable} "${output}" PARENT_SCOPE)
|
if(output STREQUAL "")
|
||||||
|
set(${variable} FALSE PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${variable} TRUE PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_subject variable)
|
||||||
|
_git_easy_command(log -1 --format=%s)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(get_git_dir variable)
|
||||||
|
_git_easy_command(rev-parse --git-dir)
|
||||||
endfunction()
|
endfunction()
|
|
@ -76,7 +76,7 @@ LOCAL_SRC_FILES := am_map.c \
|
||||||
android/i_system.c \
|
android/i_system.c \
|
||||||
android/i_video.c
|
android/i_video.c
|
||||||
|
|
||||||
LOCAL_CFLAGS += -DPLATFORM_ANDROID -DNONX86 -DLINUX -DDEBUGMODE -DNOASM -DNOPIX -DUNIXCOMMON -DNOTERMIOS
|
LOCAL_CFLAGS += -DPLATFORM_ANDROID -DNONX86 -DLINUX -DDEBUGMODE -DNOPIX -DUNIXCOMMON -DNOTERMIOS
|
||||||
|
|
||||||
LOCAL_MODULE := libsrb2
|
LOCAL_MODULE := libsrb2
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,150 @@
|
||||||
include(clang-tidy-default)
|
include(clang-tidy-default)
|
||||||
|
|
||||||
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
|
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
||||||
|
comptime.c
|
||||||
|
md5.c
|
||||||
|
config.h.in
|
||||||
|
string.c
|
||||||
|
d_main.c
|
||||||
|
d_clisrv.c
|
||||||
|
d_net.c
|
||||||
|
d_netfil.c
|
||||||
|
d_netcmd.c
|
||||||
|
dehacked.c
|
||||||
|
deh_soc.c
|
||||||
|
deh_lua.c
|
||||||
|
deh_tables.c
|
||||||
|
z_zone.c
|
||||||
|
f_finale.c
|
||||||
|
f_wipe.c
|
||||||
|
g_demo.c
|
||||||
|
g_game.c
|
||||||
|
g_input.c
|
||||||
|
am_map.c
|
||||||
|
command.c
|
||||||
|
console.c
|
||||||
|
hu_stuff.c
|
||||||
|
i_time.c
|
||||||
|
y_inter.c
|
||||||
|
st_stuff.c
|
||||||
|
m_aatree.c
|
||||||
|
m_anigif.c
|
||||||
|
m_argv.c
|
||||||
|
m_bbox.c
|
||||||
|
m_cheat.c
|
||||||
|
m_cond.c
|
||||||
|
m_easing.c
|
||||||
|
m_fixed.c
|
||||||
|
m_menu.c
|
||||||
|
m_misc.c
|
||||||
|
m_perfstats.c
|
||||||
|
m_random.c
|
||||||
|
m_queue.c
|
||||||
|
info.c
|
||||||
|
p_ceilng.c
|
||||||
|
p_enemy.c
|
||||||
|
p_floor.c
|
||||||
|
p_inter.c
|
||||||
|
p_lights.c
|
||||||
|
p_map.c
|
||||||
|
p_maputl.c
|
||||||
|
p_mobj.c
|
||||||
|
p_polyobj.c
|
||||||
|
p_saveg.c
|
||||||
|
p_setup.c
|
||||||
|
p_sight.c
|
||||||
|
p_spec.c
|
||||||
|
p_telept.c
|
||||||
|
p_tick.c
|
||||||
|
p_user.c
|
||||||
|
p_slopes.c
|
||||||
|
tables.c
|
||||||
|
r_bsp.c
|
||||||
|
r_data.c
|
||||||
|
r_draw.c
|
||||||
|
r_fps.c
|
||||||
|
r_main.c
|
||||||
|
r_plane.c
|
||||||
|
r_segs.c
|
||||||
|
r_skins.c
|
||||||
|
r_sky.c
|
||||||
|
r_splats.c
|
||||||
|
r_things.c
|
||||||
|
r_bbox.c
|
||||||
|
r_textures.c
|
||||||
|
r_patch.c
|
||||||
|
r_patchrotation.c
|
||||||
|
r_picformats.c
|
||||||
|
r_portal.c
|
||||||
|
screen.c
|
||||||
|
taglist.c
|
||||||
|
v_video.c
|
||||||
|
s_sound.c
|
||||||
|
sounds.c
|
||||||
|
w_wad.c
|
||||||
|
filesrch.c
|
||||||
|
mserv.c
|
||||||
|
http-mserv.c
|
||||||
|
i_tcp.c
|
||||||
|
lzf.c
|
||||||
|
b_bot.c
|
||||||
|
u_list.c
|
||||||
|
lua_script.c
|
||||||
|
lua_baselib.c
|
||||||
|
lua_mathlib.c
|
||||||
|
lua_hooklib.c
|
||||||
|
lua_consolelib.c
|
||||||
|
lua_infolib.c
|
||||||
|
lua_mobjlib.c
|
||||||
|
lua_playerlib.c
|
||||||
|
lua_skinlib.c
|
||||||
|
lua_thinkerlib.c
|
||||||
|
lua_maplib.c
|
||||||
|
lua_taglib.c
|
||||||
|
lua_polyobjlib.c
|
||||||
|
lua_blockmaplib.c
|
||||||
|
lua_hudlib.c
|
||||||
|
lua_hudlib_drawlist.c
|
||||||
|
lua_inputlib.c
|
||||||
|
)
|
||||||
|
|
||||||
if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows" AND NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
|
# This updates the modification time for comptime.c at the
|
||||||
# On MinGW with internal libraries, link the standard library statically
|
# end of building so when the build system is ran next time,
|
||||||
target_link_options(SRB2SDL2 PRIVATE "-static")
|
# that file gets flagged. comptime.c will always be rebuilt.
|
||||||
|
#
|
||||||
|
# This begs the question, why always rebuild comptime.c?
|
||||||
|
# Some things like the git commit must be checked each time
|
||||||
|
# the program is built. But the build system determines which
|
||||||
|
# files should be rebuilt before anything else. So
|
||||||
|
# comptime.c, which only needs to be rebuilt based on
|
||||||
|
# information known at build time, must be told to rebuild
|
||||||
|
# before that information can be ascertained.
|
||||||
|
add_custom_command(
|
||||||
|
TARGET SRB2SDL2
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/comptime.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# config.h is generated by this command. It should be done at
|
||||||
|
# build time for accurate git information and before anything
|
||||||
|
# that needs it, obviously.
|
||||||
|
add_custom_target(_SRB2_reconf ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/.. -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Comptime.cmake
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.."
|
||||||
|
)
|
||||||
|
add_dependencies(SRB2SDL2 _SRB2_reconf)
|
||||||
|
|
||||||
|
if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
||||||
|
target_link_options(SRB2SDL2 PRIVATE "-Wl,--disable-dynamicbase")
|
||||||
|
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
|
||||||
|
# On MinGW with internal libraries, link the standard library statically
|
||||||
|
target_link_options(SRB2SDL2 PRIVATE "-static")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17)
|
target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17)
|
||||||
|
|
||||||
# Core sources
|
|
||||||
target_sourcefile(c)
|
|
||||||
target_sources(SRB2SDL2 PRIVATE comptime.c md5.c config.h.in)
|
|
||||||
|
|
||||||
set(SRB2_ASM_SOURCES vid_copy.s)
|
|
||||||
|
|
||||||
set(SRB2_NASM_SOURCES tmap_mmx.nas tmap.nas)
|
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
set(SRB2_CONFIG_USEASM OFF CACHE BOOL
|
|
||||||
"Enable NASM tmap implementation for software mode speedup.")
|
|
||||||
set(SRB2_CONFIG_YASM OFF CACHE BOOL
|
|
||||||
"Use YASM in place of NASM.")
|
|
||||||
set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL
|
set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL
|
||||||
"Compile a development build of SRB2.")
|
"Compile a development build of SRB2.")
|
||||||
|
|
||||||
|
@ -78,33 +201,6 @@ if("${SRB2_CONFIG_HWRENDER}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${SRB2_CONFIG_USEASM})
|
|
||||||
#SRB2_ASM_FLAGS can be used to pass flags to either nasm or yasm.
|
|
||||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
|
||||||
set(SRB2_ASM_FLAGS "-DLINUX ${SRB2_ASM_FLAGS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${SRB2_CONFIG_YASM})
|
|
||||||
set(CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS} nas)
|
|
||||||
set(CMAKE_ASM_YASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
|
|
||||||
enable_language(ASM_YASM)
|
|
||||||
else()
|
|
||||||
set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS} nas)
|
|
||||||
set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
|
|
||||||
enable_language(ASM_NASM)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SRB2_USEASM ON)
|
|
||||||
target_compile_definitions(SRB2SDL2 PRIVATE -DUSEASM)
|
|
||||||
target_compile_options(SRB2SDL2 PRIVATE -msse3 -mfpmath=sse)
|
|
||||||
|
|
||||||
target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES}
|
|
||||||
${SRB2_NASM_SOURCES})
|
|
||||||
else()
|
|
||||||
set(SRB2_USEASM OFF)
|
|
||||||
target_compile_definitions(SRB2SDL2 PRIVATE -DNONX86 -DNORUSEASM)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
|
|
||||||
# If using CCACHE, then force it.
|
# If using CCACHE, then force it.
|
||||||
|
|
25
src/Makefile
25
src/Makefile
|
@ -47,8 +47,6 @@
|
||||||
# HAVE_MINIUPNPC=1 - Enable automated port forwarding.
|
# HAVE_MINIUPNPC=1 - Enable automated port forwarding.
|
||||||
# Already enabled by default for 32-bit
|
# Already enabled by default for 32-bit
|
||||||
# Windows.
|
# Windows.
|
||||||
# NOASM=1 - Disable hand optimized assembly code for the
|
|
||||||
# Software renderer.
|
|
||||||
# NOPNG=1 - Disable PNG graphics support. (TODO: double
|
# NOPNG=1 - Disable PNG graphics support. (TODO: double
|
||||||
# check netplay compatible.)
|
# check netplay compatible.)
|
||||||
# NOCURL=1 - Disable libcurl--HTTP capability.
|
# NOCURL=1 - Disable libcurl--HTTP capability.
|
||||||
|
@ -88,7 +86,6 @@
|
||||||
# executable.
|
# executable.
|
||||||
# WINDOWSHELL=1 - Use Windows commands.
|
# WINDOWSHELL=1 - Use Windows commands.
|
||||||
# PREFIX= - Prefix to many commands, for cross compiling.
|
# PREFIX= - Prefix to many commands, for cross compiling.
|
||||||
# YASM=1 - Use Yasm instead of NASM assembler.
|
|
||||||
# STABS=1 - ?
|
# STABS=1 - ?
|
||||||
# ECHO=1 - Print out each command in the build process.
|
# ECHO=1 - Print out each command in the build process.
|
||||||
# NOECHOFILENAMES=1 - Don't print out each that is being
|
# NOECHOFILENAMES=1 - Don't print out each that is being
|
||||||
|
@ -148,22 +145,6 @@ OBJCOPY:=$(call Prefix,objcopy)
|
||||||
OBJDUMP:=$(call Prefix,objdump)
|
OBJDUMP:=$(call Prefix,objdump)
|
||||||
WINDRES:=$(call Prefix,windres)
|
WINDRES:=$(call Prefix,windres)
|
||||||
|
|
||||||
ifdef YASM
|
|
||||||
NASM?=yasm
|
|
||||||
else
|
|
||||||
NASM?=nasm
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef YASM
|
|
||||||
ifdef STABS
|
|
||||||
NASMOPTS?=-g stabs
|
|
||||||
else
|
|
||||||
NASMOPTS?=-g dwarf2
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
NASMOPTS?=-g
|
|
||||||
endif
|
|
||||||
|
|
||||||
GZIP?=gzip
|
GZIP?=gzip
|
||||||
GZIP_OPTS?=-9 -f -n
|
GZIP_OPTS?=-9 -f -n
|
||||||
ifdef WINDOWSHELL
|
ifdef WINDOWSHELL
|
||||||
|
@ -187,8 +168,6 @@ makedir:=../make
|
||||||
opts:=-DCOMPVERSION -g
|
opts:=-DCOMPVERSION -g
|
||||||
libs:=
|
libs:=
|
||||||
|
|
||||||
nasm_format:=
|
|
||||||
|
|
||||||
# This is a list of variables names, of which if defined,
|
# This is a list of variables names, of which if defined,
|
||||||
# also defines the name as a macro to the compiler.
|
# also defines the name as a macro to the compiler.
|
||||||
passthru_opts:=
|
passthru_opts:=
|
||||||
|
@ -316,7 +295,6 @@ endif
|
||||||
|
|
||||||
LD:=$(CC)
|
LD:=$(CC)
|
||||||
cc:=$(cc) $(opts)
|
cc:=$(cc) $(opts)
|
||||||
nasm=$(NASM) $(NASMOPTS) -f $(nasm_format)
|
|
||||||
ifdef UPX
|
ifdef UPX
|
||||||
upx=$(UPX) $(UPX_OPTS)
|
upx=$(UPX) $(UPX_OPTS)
|
||||||
endif
|
endif
|
||||||
|
@ -393,7 +371,6 @@ $(objdir)/%.$(1) : %.$(2) | $$$$(@D)/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call _recipe,o,c,$(cc) -c -o $$@ $$<))
|
$(eval $(call _recipe,o,c,$(cc) -c -o $$@ $$<))
|
||||||
$(eval $(call _recipe,o,nas,$(nasm) -o $$@ $$<))
|
|
||||||
$(eval $(call _recipe,o,s,$(cc) $(asflags) -c -o $$@ $$<))
|
$(eval $(call _recipe,o,s,$(cc) $(asflags) -c -o $$@ $$<))
|
||||||
$(eval $(call _recipe,res,rc,$(windres) -i $$< -o $$@))
|
$(eval $(call _recipe,res,rc,$(windres) -i $$< -o $$@))
|
||||||
|
|
||||||
|
@ -414,3 +391,5 @@ ifdef WINDOWSHELL
|
||||||
else
|
else
|
||||||
@:
|
@:
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(warning The handwritten GNU Makefile for SRB2 is deprecated, and may be removed in the future. Please consider switching to CMake.)
|
||||||
|
|
|
@ -18,13 +18,6 @@ opts+=-DHWRENDER
|
||||||
sources+=$(call List,hardware/Sourcefile)
|
sources+=$(call List,hardware/Sourcefile)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NOASM
|
|
||||||
ifndef NONX86
|
|
||||||
sources+=tmap.nas tmap_mmx.nas
|
|
||||||
opts+=-DUSEASM
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOMD5
|
ifndef NOMD5
|
||||||
sources+=md5.c
|
sources+=md5.c
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -9,10 +9,6 @@ opts+=-DUNIXCOMMON -DLUA_USE_POSIX
|
||||||
# instead of addresses
|
# instead of addresses
|
||||||
libs+=-lm -rdynamic
|
libs+=-lm -rdynamic
|
||||||
|
|
||||||
ifndef nasm_format
|
|
||||||
nasm_format:=elf -DLINUX
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOHW
|
ifndef NOHW
|
||||||
opts+=-I/usr/X11R6/include
|
opts+=-I/usr/X11R6/include
|
||||||
libs+=-L/usr/X11R6/lib
|
libs+=-L/usr/X11R6/lib
|
||||||
|
@ -35,7 +31,6 @@ endif
|
||||||
# FIXME: UNTESTED
|
# FIXME: UNTESTED
|
||||||
#ifdef SOLARIS
|
#ifdef SOLARIS
|
||||||
#NOIPX=1
|
#NOIPX=1
|
||||||
#NOASM=1
|
|
||||||
#opts+=-I/usr/local/include -I/opt/sfw/include \
|
#opts+=-I/usr/local/include -I/opt/sfw/include \
|
||||||
# -DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
|
# -DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
|
||||||
#libs+=-L/opt/sfw/lib -lsocket -lnsl
|
#libs+=-L/opt/sfw/lib -lsocket -lnsl
|
||||||
|
|
|
@ -39,7 +39,6 @@ else ifdef SOLARIS # FIXME: UNTESTED
|
||||||
UNIX=1
|
UNIX=1
|
||||||
platform=solaris
|
platform=solaris
|
||||||
else ifdef CYGWIN32 # FIXME: UNTESTED
|
else ifdef CYGWIN32 # FIXME: UNTESTED
|
||||||
nasm_format=win32
|
|
||||||
platform=cygwin
|
platform=cygwin
|
||||||
else ifdef MINGW
|
else ifdef MINGW
|
||||||
ifdef MINGW64
|
ifdef MINGW64
|
||||||
|
|
|
@ -56,13 +56,6 @@ SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
|
||||||
$(eval $(call Propogate_flags,SDL))
|
$(eval $(call Propogate_flags,SDL))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# use the x86 asm code
|
|
||||||
ifndef CYGWIN32
|
|
||||||
ifndef NOASM
|
|
||||||
USEASM=1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef MINGW
|
ifdef MINGW
|
||||||
ifndef NOSDLMAIN
|
ifndef NOSDLMAIN
|
||||||
SDLMAIN=1
|
SDLMAIN=1
|
||||||
|
|
|
@ -17,8 +17,6 @@ sources+=win32/Srb2win.rc
|
||||||
opts+=-DSTDC_HEADERS
|
opts+=-DSTDC_HEADERS
|
||||||
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
|
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
|
||||||
|
|
||||||
nasm_format:=win32
|
|
||||||
|
|
||||||
SDL?=1
|
SDL?=1
|
||||||
|
|
||||||
ifndef NOHW
|
ifndef NOHW
|
||||||
|
|
|
@ -81,7 +81,6 @@ mserv.c
|
||||||
http-mserv.c
|
http-mserv.c
|
||||||
i_tcp.c
|
i_tcp.c
|
||||||
lzf.c
|
lzf.c
|
||||||
vid_copy.s
|
|
||||||
b_bot.c
|
b_bot.c
|
||||||
u_list.c
|
u_list.c
|
||||||
lua_script.c
|
lua_script.c
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
// Copyright (C) 1999-2023 by Sonic Team Junior.
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file asm_defs.inc
|
|
||||||
/// \brief must match the C structures
|
|
||||||
|
|
||||||
#ifndef __ASM_DEFS__
|
|
||||||
#define __ASM_DEFS__
|
|
||||||
|
|
||||||
// this makes variables more noticable,
|
|
||||||
// and make the label match with C code
|
|
||||||
|
|
||||||
// Linux, unlike DOS, has no "_" 19990119 by Kin
|
|
||||||
// and nasm needs .data code segs under linux 20010210 by metzgermeister
|
|
||||||
// FIXME: nasm ignores these settings, so I put the macros into the makefile
|
|
||||||
#ifdef __ELF__
|
|
||||||
#define C(label) label
|
|
||||||
#define CODE_SEG .data
|
|
||||||
#else
|
|
||||||
#define C(label) _##label
|
|
||||||
#define CODE_SEG .text
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This is a more readable way to access the arguments passed from C code */
|
|
||||||
/* PLEASE NOTE: it is supposed that all arguments passed from C code are */
|
|
||||||
/* 32bit integer (INT32, long, and most *pointers) */
|
|
||||||
#define ARG1 8(%ebp)
|
|
||||||
#define ARG2 12(%ebp)
|
|
||||||
#define ARG3 16(%ebp)
|
|
||||||
#define ARG4 20(%ebp)
|
|
||||||
#define ARG5 24(%ebp)
|
|
||||||
#define ARG6 28(%ebp)
|
|
||||||
#define ARG7 32(%ebp)
|
|
||||||
#define ARG8 36(%ebp)
|
|
||||||
#define ARG9 40(%ebp) //(c)tm ... Allegro by Shawn Hargreaves.
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1 +1,28 @@
|
||||||
target_sourcefile(c)
|
target_sources(SRB2SDL2 PRIVATE
|
||||||
|
lapi.c
|
||||||
|
lbaselib.c
|
||||||
|
ldo.c
|
||||||
|
lfunc.c
|
||||||
|
linit.c
|
||||||
|
liolib.c
|
||||||
|
llex.c
|
||||||
|
lmem.c
|
||||||
|
lobject.c
|
||||||
|
lstate.c
|
||||||
|
lstrlib.c
|
||||||
|
ltablib.c
|
||||||
|
lundump.c
|
||||||
|
lzio.c
|
||||||
|
lauxlib.c
|
||||||
|
lcode.c
|
||||||
|
ldebug.c
|
||||||
|
ldump.c
|
||||||
|
lgc.c
|
||||||
|
lopcodes.c
|
||||||
|
lparser.c
|
||||||
|
lstring.c
|
||||||
|
ltable.c
|
||||||
|
ltm.c
|
||||||
|
lvm.c
|
||||||
|
loslib.c
|
||||||
|
)
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
const char *compbranch = SRB2_COMP_BRANCH;
|
const char *compbranch = SRB2_COMP_BRANCH;
|
||||||
const char *comprevision = SRB2_COMP_REVISION;
|
const char *comprevision = SRB2_COMP_REVISION;
|
||||||
|
const char *compnote = SRB2_COMP_NOTE;
|
||||||
|
const char *comptype = CMAKE_BUILD_TYPE;
|
||||||
|
const int compoptimized = SRB2_COMP_OPTIMIZED;
|
||||||
|
|
||||||
#elif (defined(COMPVERSION))
|
#elif (defined(COMPVERSION))
|
||||||
#include "comptime.h"
|
#include "comptime.h"
|
||||||
|
@ -21,5 +24,12 @@ const char *comprevision = "illegal";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const int compuncommitted =
|
||||||
|
#if (defined(COMPVERSION_UNCOMMITTED))
|
||||||
|
1;
|
||||||
|
#else
|
||||||
|
0;
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *compdate = __DATE__;
|
const char *compdate = __DATE__;
|
||||||
const char *comptime = __TIME__;
|
const char *comptime = __TIME__;
|
||||||
|
|
|
@ -11,8 +11,18 @@
|
||||||
|
|
||||||
#ifdef CMAKECONFIG
|
#ifdef CMAKECONFIG
|
||||||
|
|
||||||
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
|
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
|
||||||
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
|
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
|
||||||
|
#define SRB2_COMP_NOTE "${SRB2_COMP_NOTE}"
|
||||||
|
// This is done with configure_file instead of defines in order to avoid
|
||||||
|
// recompiling the whole target whenever the working directory state changes
|
||||||
|
#cmakedefine SRB2_COMP_UNCOMMITTED
|
||||||
|
#ifdef SRB2_COMP_UNCOMMITTED
|
||||||
|
#define COMPVERSION_UNCOMMITTED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}"
|
||||||
|
#cmakedefine01 SRB2_COMP_OPTIMIZED
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -4584,7 +4584,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||||
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
|
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
|
||||||
tic_t faketic = maketic;
|
tic_t faketic = maketic;
|
||||||
if ((!!(netcmds[maketic % BACKUPTICS][netconsole].angleturn & TICCMD_RECEIVED))
|
if ((!!(netcmds[maketic % BACKUPTICS][netconsole].angleturn & TICCMD_RECEIVED))
|
||||||
&& (maketic - firstticstosend < BACKUPTICS))
|
&& (maketic - firstticstosend < BACKUPTICS - 1))
|
||||||
faketic++;
|
faketic++;
|
||||||
|
|
||||||
// Copy ticcmd
|
// Copy ticcmd
|
||||||
|
|
30
src/d_main.c
30
src/d_main.c
|
@ -71,6 +71,7 @@
|
||||||
#include "g_input.h" // tutorial mode control scheming
|
#include "g_input.h" // tutorial mode control scheming
|
||||||
#include "m_perfstats.h"
|
#include "m_perfstats.h"
|
||||||
#include "m_random.h"
|
#include "m_random.h"
|
||||||
|
#include "command.h"
|
||||||
|
|
||||||
#ifdef CMAKECONFIG
|
#ifdef CMAKECONFIG
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -1216,6 +1217,15 @@ D_ConvertVersionNumbers (void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Command_assert(void)
|
||||||
|
{
|
||||||
|
#if !defined(NDEBUG) || defined(PARANOIA)
|
||||||
|
CONS_Printf("Yes, assertions are enabled.\n");
|
||||||
|
#else
|
||||||
|
CONS_Printf("No, assertions are NOT enabled.\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// D_SRB2Main
|
// D_SRB2Main
|
||||||
//
|
//
|
||||||
|
@ -1229,6 +1239,11 @@ void D_SRB2Main(void)
|
||||||
/* break the version string into version numbers, for netplay */
|
/* break the version string into version numbers, for netplay */
|
||||||
D_ConvertVersionNumbers();
|
D_ConvertVersionNumbers();
|
||||||
|
|
||||||
|
if (!strcmp(compbranch, ""))
|
||||||
|
{
|
||||||
|
compbranch = "detached HEAD";
|
||||||
|
}
|
||||||
|
|
||||||
// Print GPL notice for our console users (Linux)
|
// Print GPL notice for our console users (Linux)
|
||||||
CONS_Printf(
|
CONS_Printf(
|
||||||
"\n\nSonic Robo Blast 2\n"
|
"\n\nSonic Robo Blast 2\n"
|
||||||
|
@ -1365,6 +1380,8 @@ void D_SRB2Main(void)
|
||||||
// Do this up here so that WADs loaded through the command line can use ExecCfg
|
// Do this up here so that WADs loaded through the command line can use ExecCfg
|
||||||
COM_Init();
|
COM_Init();
|
||||||
|
|
||||||
|
COM_AddCommand("assert", Command_assert, COM_LUA);
|
||||||
|
|
||||||
// Add any files specified on the command line with
|
// Add any files specified on the command line with
|
||||||
// "-file <file>" or "-folder <folder>" to the add-on list
|
// "-file <file>" or "-folder <folder>" to the add-on list
|
||||||
if (!((M_GetUrlProtocolArg() || M_CheckParm("-connect")) && !M_CheckParm("-server")))
|
if (!((M_GetUrlProtocolArg() || M_CheckParm("-connect")) && !M_CheckParm("-server")))
|
||||||
|
@ -1720,14 +1737,15 @@ void D_SRB2Main(void)
|
||||||
// Prevent warping to nonexistent levels
|
// Prevent warping to nonexistent levels
|
||||||
if (W_CheckNumForName(G_BuildMapName(pstartmap)) == LUMPERROR)
|
if (W_CheckNumForName(G_BuildMapName(pstartmap)) == LUMPERROR)
|
||||||
I_Error("Could not warp to %s (map not found)\n", G_BuildMapName(pstartmap));
|
I_Error("Could not warp to %s (map not found)\n", G_BuildMapName(pstartmap));
|
||||||
// Prevent warping to locked levels
|
|
||||||
// ... unless you're in a dedicated server. Yes, technically this means you can view any level by
|
|
||||||
// running a dedicated server and joining it yourself, but that's better than making dedicated server's
|
|
||||||
// lives hell.
|
|
||||||
else if (!dedicated && M_MapLocked(pstartmap, serverGamedata))
|
|
||||||
I_Error("You need to unlock this level before you can warp to it!\n");
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (M_CampaignWarpIsCheat(gametype, pstartmap, serverGamedata))
|
||||||
|
{
|
||||||
|
// If you're warping via command line, you know what you're doing.
|
||||||
|
// No need to I_Error over this.
|
||||||
|
G_SetUsedCheats(false);
|
||||||
|
}
|
||||||
|
|
||||||
D_MapChange(pstartmap, gametype, ultimatemode, true, 0, false, false);
|
D_MapChange(pstartmap, gametype, ultimatemode, true, 0, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
145
src/d_netcmd.c
145
src/d_netcmd.c
|
@ -1902,8 +1902,8 @@ static void Command_Map_f(void)
|
||||||
size_t option_gametype;
|
size_t option_gametype;
|
||||||
const char *gametypename;
|
const char *gametypename;
|
||||||
boolean newresetplayers;
|
boolean newresetplayers;
|
||||||
|
boolean prevent_cheat;
|
||||||
boolean wouldSetCheats;
|
boolean set_cheated;
|
||||||
|
|
||||||
INT32 newmapnum;
|
INT32 newmapnum;
|
||||||
|
|
||||||
|
@ -1924,21 +1924,33 @@ static void Command_Map_f(void)
|
||||||
option_gametype = COM_CheckPartialParm("-g");
|
option_gametype = COM_CheckPartialParm("-g");
|
||||||
newresetplayers = ! COM_CheckParm("-noresetplayers");
|
newresetplayers = ! COM_CheckParm("-noresetplayers");
|
||||||
|
|
||||||
wouldSetCheats =
|
prevent_cheat = !( usedCheats ) && !( option_force || cv_debug );
|
||||||
!( netgame || multiplayer ) &&
|
|
||||||
!( usedCheats );
|
|
||||||
|
|
||||||
if (wouldSetCheats && !option_force)
|
if (!( netgame || multiplayer ))
|
||||||
{
|
{
|
||||||
/* May want to be more descriptive? */
|
if (prevent_cheat)
|
||||||
CONS_Printf(M_GetText("Sorry, level change disabled in single player.\n"));
|
{
|
||||||
return;
|
/* May want to be more descriptive? */
|
||||||
|
CONS_Printf(M_GetText("Cheats must be enabled to level change in single player.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_cheated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newresetplayers && !cv_debug)
|
if (!newresetplayers)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("DEVMODE must be enabled.\n"));
|
if (prevent_cheat)
|
||||||
return;
|
{
|
||||||
|
CONS_Printf(M_GetText("Cheats must be enabled to use -noresetplayers.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_cheated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option_gametype)
|
if (option_gametype)
|
||||||
|
@ -1946,7 +1958,7 @@ static void Command_Map_f(void)
|
||||||
if (!multiplayer)
|
if (!multiplayer)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText(
|
CONS_Printf(M_GetText(
|
||||||
"You can't switch gametypes in single player!\n"));
|
"You can't switch gametypes in single player!\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (COM_Argc() < option_gametype + 2)/* no argument after? */
|
else if (COM_Argc() < option_gametype + 2)/* no argument after? */
|
||||||
|
@ -1959,7 +1971,9 @@ static void Command_Map_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!( first_option = COM_FirstOption() ))
|
if (!( first_option = COM_FirstOption() ))
|
||||||
|
{
|
||||||
first_option = COM_Argc();
|
first_option = COM_Argc();
|
||||||
|
}
|
||||||
|
|
||||||
if (first_option < 2)
|
if (first_option < 2)
|
||||||
{
|
{
|
||||||
|
@ -1982,11 +1996,6 @@ static void Command_Map_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wouldSetCheats && option_force)
|
|
||||||
{
|
|
||||||
G_SetUsedCheats(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// new gametype value
|
// new gametype value
|
||||||
// use current one by default
|
// use current one by default
|
||||||
if (option_gametype)
|
if (option_gametype)
|
||||||
|
@ -2028,15 +2037,13 @@ static void Command_Map_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't use a gametype the map doesn't support
|
// don't use a gametype the map doesn't support
|
||||||
if (cv_debug || option_force || cv_skipmapcheck.value)
|
|
||||||
fromlevelselect = false; // The player wants us to trek on anyway. Do so.
|
|
||||||
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
||||||
else
|
if (!(
|
||||||
|
mapheaderinfo[newmapnum-1] &&
|
||||||
|
mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)
|
||||||
|
))
|
||||||
{
|
{
|
||||||
if (!(
|
if (prevent_cheat && !cv_skipmapcheck.value)
|
||||||
mapheaderinfo[newmapnum-1] &&
|
|
||||||
mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)
|
|
||||||
))
|
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("%s (%s) doesn't support %s mode!\n(Use -force to override)\n"), realmapname, G_BuildMapName(newmapnum),
|
CONS_Alert(CONS_WARNING, M_GetText("%s (%s) doesn't support %s mode!\n(Use -force to override)\n"), realmapname, G_BuildMapName(newmapnum),
|
||||||
(multiplayer ? gametype_cons_t[newgametype].strvalue : "Single Player"));
|
(multiplayer ? gametype_cons_t[newgametype].strvalue : "Single Player"));
|
||||||
|
@ -2046,23 +2053,33 @@ static void Command_Map_f(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fromlevelselect =
|
// The player wants us to trek on anyway. Do so.
|
||||||
( netgame || multiplayer ) &&
|
fromlevelselect = false;
|
||||||
newgametype == gametype &&
|
set_cheated = ((gametypedefaultrules[newgametype] & GTR_CAMPAIGN) == GTR_CAMPAIGN);
|
||||||
gametypedefaultrules[newgametype] & GTR_CAMPAIGN;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fromlevelselect =
|
||||||
|
( netgame || multiplayer ) &&
|
||||||
|
newgametype == gametype &&
|
||||||
|
(gametypedefaultrules[newgametype] & GTR_CAMPAIGN);
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent warping to locked levels
|
// Prevent warping to locked levels
|
||||||
// ... unless you're in a dedicated server. Yes, technically this means you can view any level by
|
if (M_CampaignWarpIsCheat(newgametype, newmapnum, serverGamedata))
|
||||||
// running a dedicated server and joining it yourself, but that's better than making dedicated server's
|
|
||||||
// lives hell.
|
|
||||||
if (!dedicated && M_MapLocked(newmapnum, serverGamedata))
|
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You need to unlock this level before you can warp to it!\n"));
|
if (prevent_cheat)
|
||||||
Z_Free(realmapname);
|
{
|
||||||
Z_Free(mapname);
|
CONS_Alert(CONS_NOTICE, M_GetText("Cheats must be enabled to warp to a locked level!\n"));
|
||||||
return;
|
Z_Free(realmapname);
|
||||||
|
Z_Free(mapname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_cheated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ultimate Mode only in SP via menu
|
// Ultimate Mode only in SP via menu
|
||||||
|
@ -2079,6 +2096,11 @@ static void Command_Map_f(void)
|
||||||
}
|
}
|
||||||
tutorialmode = false; // warping takes us out of tutorial mode
|
tutorialmode = false; // warping takes us out of tutorial mode
|
||||||
|
|
||||||
|
if (set_cheated && !usedCheats)
|
||||||
|
{
|
||||||
|
G_SetUsedCheats(false);
|
||||||
|
}
|
||||||
|
|
||||||
D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect);
|
D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect);
|
||||||
|
|
||||||
Z_Free(realmapname);
|
Z_Free(realmapname);
|
||||||
|
@ -2120,11 +2142,13 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||||
|
|
||||||
lastgametype = gametype;
|
lastgametype = gametype;
|
||||||
gametype = READUINT8(*cp);
|
gametype = READUINT8(*cp);
|
||||||
G_SetGametype(gametype); // I fear putting that macro as an argument
|
|
||||||
|
|
||||||
if (gametype < 0 || gametype >= gametypecount)
|
if (gametype < 0 || gametype >= gametypecount)
|
||||||
gametype = lastgametype;
|
gametype = lastgametype;
|
||||||
else if (gametype != lastgametype)
|
else
|
||||||
|
G_SetGametype(gametype);
|
||||||
|
|
||||||
|
if (gametype != lastgametype)
|
||||||
D_GameTypeChanged(lastgametype); // emulate consvar_t behavior for gametype
|
D_GameTypeChanged(lastgametype); // emulate consvar_t behavior for gametype
|
||||||
|
|
||||||
skipprecutscene = ((flags & (1<<2)) != 0);
|
skipprecutscene = ((flags & (1<<2)) != 0);
|
||||||
|
@ -2146,12 +2170,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||||
if (demoplayback && !timingdemo)
|
if (demoplayback && !timingdemo)
|
||||||
precache = false;
|
precache = false;
|
||||||
|
|
||||||
if (resetplayer && !FLS)
|
|
||||||
{
|
|
||||||
emeralds = 0;
|
|
||||||
memset(&luabanks, 0, sizeof(luabanks));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modeattacking)
|
if (modeattacking)
|
||||||
{
|
{
|
||||||
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
||||||
|
@ -3859,7 +3877,7 @@ static void Command_ListWADS_f(void)
|
||||||
static void Command_Version_f(void)
|
static void Command_Version_f(void)
|
||||||
{
|
{
|
||||||
#ifdef DEVELOP
|
#ifdef DEVELOP
|
||||||
CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s) ", compbranch, comprevision, compdate, comptime);
|
CONS_Printf("Sonic Robo Blast 2 %s %s %s (%s %s) ", compbranch, comprevision, compnote, compdate, comptime);
|
||||||
#else
|
#else
|
||||||
CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch);
|
CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch);
|
||||||
#endif
|
#endif
|
||||||
|
@ -3893,11 +3911,6 @@ static void Command_Version_f(void)
|
||||||
else // 16-bit? 128-bit?
|
else // 16-bit? 128-bit?
|
||||||
CONS_Printf("Bits Unknown ");
|
CONS_Printf("Bits Unknown ");
|
||||||
|
|
||||||
// No ASM?
|
|
||||||
#ifdef NOASM
|
|
||||||
CONS_Printf("\x85" "NOASM " "\x80");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Debug build
|
// Debug build
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
CONS_Printf("\x85" "DEBUG " "\x80");
|
CONS_Printf("\x85" "DEBUG " "\x80");
|
||||||
|
@ -4263,9 +4276,6 @@ void D_GameTypeChanged(INT32 lastgametype)
|
||||||
else if (!multiplayer && !netgame)
|
else if (!multiplayer && !netgame)
|
||||||
{
|
{
|
||||||
G_SetGametype(GT_COOP);
|
G_SetGametype(GT_COOP);
|
||||||
// These shouldn't matter anymore
|
|
||||||
//CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue);
|
|
||||||
//CV_SetValue(&cv_itemrespawn, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset timelimit and pointlimit in race/coop, prevent stupid cheats
|
// reset timelimit and pointlimit in race/coop, prevent stupid cheats
|
||||||
|
@ -4566,25 +4576,37 @@ static void Command_Mapmd5_f(void)
|
||||||
CONS_Printf(M_GetText("You must be in a level to use this.\n"));
|
CONS_Printf(M_GetText("You must be in a level to use this.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void D_SendExitLevel(boolean cheat)
|
||||||
|
{
|
||||||
|
UINT8 buf[8];
|
||||||
|
UINT8 *buf_p = buf;
|
||||||
|
|
||||||
|
WRITEUINT8(buf_p, cheat);
|
||||||
|
|
||||||
|
SendNetXCmd(XD_EXITLEVEL, &buf, buf_p - buf);
|
||||||
|
}
|
||||||
|
|
||||||
static void Command_ExitLevel_f(void)
|
static void Command_ExitLevel_f(void)
|
||||||
{
|
{
|
||||||
if (!(netgame || (multiplayer && gametype != GT_COOP)) && !cv_debug)
|
if (!(server || (IsPlayerAdmin(consoleplayer))))
|
||||||
CONS_Printf(M_GetText("This only works in a netgame.\n"));
|
|
||||||
else if (!(server || (IsPlayerAdmin(consoleplayer))))
|
|
||||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||||
else if (( gamestate != GS_LEVEL && gamestate != GS_CREDITS ) || demoplayback)
|
else if (( gamestate != GS_LEVEL && gamestate != GS_CREDITS ) || demoplayback)
|
||||||
CONS_Printf(M_GetText("You must be in a level to use this.\n"));
|
CONS_Printf(M_GetText("You must be in a level to use this.\n"));
|
||||||
else
|
else
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
||||||
{
|
{
|
||||||
(void)cp;
|
boolean cheat = false;
|
||||||
|
|
||||||
|
cheat = (boolean)READUINT8(*cp);
|
||||||
|
|
||||||
// Ignore duplicate XD_EXITLEVEL commands.
|
// Ignore duplicate XD_EXITLEVEL commands.
|
||||||
if (gameaction == ga_completed)
|
if (gameaction == ga_completed)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
|
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
|
||||||
{
|
{
|
||||||
|
@ -4594,6 +4616,11 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (G_CoopGametype() && cheat)
|
||||||
|
{
|
||||||
|
G_SetUsedCheats(false);
|
||||||
|
}
|
||||||
|
|
||||||
G_ExitLevel();
|
G_ExitLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,7 @@ void D_SendPlayerConfig(void);
|
||||||
void Command_ExitGame_f(void);
|
void Command_ExitGame_f(void);
|
||||||
void Command_Retry_f(void);
|
void Command_Retry_f(void);
|
||||||
void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore
|
void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore
|
||||||
|
void D_SendExitLevel(boolean cheat);
|
||||||
void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pultmode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect);
|
void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pultmode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect);
|
||||||
boolean IsPlayerAdmin(INT32 playernum);
|
boolean IsPlayerAdmin(INT32 playernum);
|
||||||
void SetAdminPlayer(INT32 playernum);
|
void SetAdminPlayer(INT32 playernum);
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#ifndef __D_THINK__
|
#ifndef __D_THINK__
|
||||||
#define __D_THINK__
|
#define __D_THINK__
|
||||||
|
|
||||||
|
#include "doomdef.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,6 +51,11 @@ typedef struct thinker_s
|
||||||
// killough 11/98: count of how many other objects reference
|
// killough 11/98: count of how many other objects reference
|
||||||
// this one using pointers. Used for garbage collection.
|
// this one using pointers. Used for garbage collection.
|
||||||
INT32 references;
|
INT32 references;
|
||||||
|
|
||||||
|
#ifdef PARANOIA
|
||||||
|
INT32 debug_mobjtype;
|
||||||
|
tic_t debug_time;
|
||||||
|
#endif
|
||||||
} thinker_t;
|
} thinker_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4551,6 +4551,7 @@ const char *const MSF_LIST[] = {
|
||||||
const char *const SSF_LIST[] = {
|
const char *const SSF_LIST[] = {
|
||||||
"OUTERSPACE",
|
"OUTERSPACE",
|
||||||
"DOUBLESTEPUP",
|
"DOUBLESTEPUP",
|
||||||
|
"NOSTEPDOWN",
|
||||||
"WINDCURRENT",
|
"WINDCURRENT",
|
||||||
"CONVEYOR",
|
"CONVEYOR",
|
||||||
"SPEEDPAD",
|
"SPEEDPAD",
|
||||||
|
@ -4567,6 +4568,8 @@ const char *const SSF_LIST[] = {
|
||||||
"ZOOMTUBEEND",
|
"ZOOMTUBEEND",
|
||||||
"FINISHLINE",
|
"FINISHLINE",
|
||||||
"ROPEHANG",
|
"ROPEHANG",
|
||||||
|
"JUMPFLIP",
|
||||||
|
"GRAVITYOVERRIDE",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,7 @@ typedef struct
|
||||||
UINT8 extrainfo;
|
UINT8 extrainfo;
|
||||||
taglist_t tags;
|
taglist_t tags;
|
||||||
fixed_t scale;
|
fixed_t scale;
|
||||||
|
fixed_t spritexscale, spriteyscale;
|
||||||
INT32 args[NUMMAPTHINGARGS];
|
INT32 args[NUMMAPTHINGARGS];
|
||||||
char *stringargs[NUMMAPTHINGSTRINGARGS];
|
char *stringargs[NUMMAPTHINGSTRINGARGS];
|
||||||
struct mobj_s *mobj;
|
struct mobj_s *mobj;
|
||||||
|
|
|
@ -108,6 +108,14 @@ FILE *fopenfile(const char*, const char*);
|
||||||
|
|
||||||
//#define NOMD5
|
//#define NOMD5
|
||||||
|
|
||||||
|
// If you don't disable ALL debug first, you get ALL debug enabled
|
||||||
|
#if !defined (NDEBUG)
|
||||||
|
#define PACKETDROP
|
||||||
|
#define PARANOIA
|
||||||
|
#define RANGECHECK
|
||||||
|
#define ZDEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
// Uncheck this to compile debugging code
|
// Uncheck this to compile debugging code
|
||||||
//#define RANGECHECK
|
//#define RANGECHECK
|
||||||
//#ifndef PARANOIA
|
//#ifndef PARANOIA
|
||||||
|
@ -637,7 +645,16 @@ UINT32 quickncasehash (const char *p, size_t n)
|
||||||
#define PUNCTUATION "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
#define PUNCTUATION "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
||||||
|
|
||||||
// Compile date and time and revision.
|
// Compile date and time and revision.
|
||||||
extern const char *compdate, *comptime, *comprevision, *compbranch;
|
extern const char
|
||||||
|
*compdate,
|
||||||
|
*comptime,
|
||||||
|
*comprevision,
|
||||||
|
*compbranch,
|
||||||
|
*compnote,
|
||||||
|
*comptype;
|
||||||
|
extern int
|
||||||
|
compuncommitted,
|
||||||
|
compoptimized;
|
||||||
|
|
||||||
// Disabled code and code under testing
|
// Disabled code and code under testing
|
||||||
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
||||||
|
|
|
@ -249,6 +249,7 @@ extern textprompt_t *textprompts[MAX_PROMPTS];
|
||||||
// For the Custom Exit linedef.
|
// For the Custom Exit linedef.
|
||||||
extern INT16 nextmapoverride;
|
extern INT16 nextmapoverride;
|
||||||
extern UINT8 skipstats;
|
extern UINT8 skipstats;
|
||||||
|
extern INT16 nextgametype;
|
||||||
|
|
||||||
extern UINT32 ssspheres; // Total # of spheres in a level
|
extern UINT32 ssspheres; // Total # of spheres in a level
|
||||||
|
|
||||||
|
|
|
@ -1644,7 +1644,7 @@ void F_GameEvaluationTicker(void)
|
||||||
sparklloop = 0;
|
sparklloop = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalecount == 5*TICRATE)
|
if (G_CoopGametype() && !stagefailed && finalecount == 5*TICRATE)
|
||||||
{
|
{
|
||||||
serverGamedata->timesBeaten++;
|
serverGamedata->timesBeaten++;
|
||||||
clientGamedata->timesBeaten++;
|
clientGamedata->timesBeaten++;
|
||||||
|
|
67
src/g_demo.c
67
src/g_demo.c
|
@ -1617,7 +1617,7 @@ void G_BeginMetal(void)
|
||||||
oldmetal.angle = mo->angle>>24;
|
oldmetal.angle = mo->angle>>24;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void G_LoadDemoExtraFiles(UINT8 **pp)
|
static void G_LoadDemoExtraFiles(UINT8 **pp, UINT16 this_demo_version)
|
||||||
{
|
{
|
||||||
UINT16 totalfiles;
|
UINT16 totalfiles;
|
||||||
char filename[MAX_WADPATH];
|
char filename[MAX_WADPATH];
|
||||||
|
@ -1627,6 +1627,12 @@ static void G_LoadDemoExtraFiles(UINT8 **pp)
|
||||||
boolean alreadyloaded;
|
boolean alreadyloaded;
|
||||||
UINT16 i, j;
|
UINT16 i, j;
|
||||||
|
|
||||||
|
if (this_demo_version < 0x0010)
|
||||||
|
{
|
||||||
|
// demo has no file list
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
totalfiles = READUINT16((*pp));
|
totalfiles = READUINT16((*pp));
|
||||||
for (i = 0; i < totalfiles; ++i)
|
for (i = 0; i < totalfiles; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1686,12 +1692,12 @@ static void G_LoadDemoExtraFiles(UINT8 **pp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void G_SkipDemoExtraFiles(UINT8 **pp)
|
static void G_SkipDemoExtraFiles(UINT8 **pp, UINT16 this_demo_version)
|
||||||
{
|
{
|
||||||
UINT16 totalfiles;
|
UINT16 totalfiles;
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
|
|
||||||
if (demoversion < 0x0010)
|
if (this_demo_version < 0x0010)
|
||||||
{
|
{
|
||||||
// demo has no file list
|
// demo has no file list
|
||||||
return;
|
return;
|
||||||
|
@ -1707,7 +1713,7 @@ static void G_SkipDemoExtraFiles(UINT8 **pp)
|
||||||
|
|
||||||
// G_CheckDemoExtraFiles: checks if our loaded WAD list matches the demo's.
|
// G_CheckDemoExtraFiles: checks if our loaded WAD list matches the demo's.
|
||||||
// Enabling quick prevents filesystem checks to see if needed files are available to load.
|
// Enabling quick prevents filesystem checks to see if needed files are available to load.
|
||||||
static UINT8 G_CheckDemoExtraFiles(UINT8 **pp, boolean quick)
|
static UINT8 G_CheckDemoExtraFiles(UINT8 **pp, boolean quick, UINT16 this_demo_version)
|
||||||
{
|
{
|
||||||
UINT16 totalfiles, filesloaded, nmusfilecount;
|
UINT16 totalfiles, filesloaded, nmusfilecount;
|
||||||
char filename[MAX_WADPATH];
|
char filename[MAX_WADPATH];
|
||||||
|
@ -1717,7 +1723,7 @@ static UINT8 G_CheckDemoExtraFiles(UINT8 **pp, boolean quick)
|
||||||
UINT16 i, j;
|
UINT16 i, j;
|
||||||
UINT8 error = DFILE_ERROR_NONE;
|
UINT8 error = DFILE_ERROR_NONE;
|
||||||
|
|
||||||
if (demoversion < 0x0010)
|
if (this_demo_version < 0x0010)
|
||||||
{
|
{
|
||||||
// demo has no file list
|
// demo has no file list
|
||||||
return DFILE_ERROR_NONE;
|
return DFILE_ERROR_NONE;
|
||||||
|
@ -1816,10 +1822,9 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
||||||
UINT8 *buffer,*p;
|
UINT8 *buffer,*p;
|
||||||
UINT8 flags;
|
UINT8 flags;
|
||||||
UINT32 oldtime, newtime, oldscore, newscore;
|
UINT32 oldtime, newtime, oldscore, newscore;
|
||||||
UINT16 oldrings, newrings, oldversion;
|
UINT16 oldrings, newrings, oldversion, newversion;
|
||||||
size_t bufsize ATTRUNUSED;
|
size_t bufsize ATTRUNUSED;
|
||||||
UINT8 c;
|
UINT8 c;
|
||||||
UINT16 s ATTRUNUSED;
|
|
||||||
UINT8 aflags = 0;
|
UINT8 aflags = 0;
|
||||||
|
|
||||||
// load the new file
|
// load the new file
|
||||||
|
@ -1835,15 +1840,15 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
||||||
I_Assert(c == VERSION);
|
I_Assert(c == VERSION);
|
||||||
c = READUINT8(p); // SUBVERSION
|
c = READUINT8(p); // SUBVERSION
|
||||||
I_Assert(c == SUBVERSION);
|
I_Assert(c == SUBVERSION);
|
||||||
s = READUINT16(p);
|
newversion = READUINT16(p);
|
||||||
I_Assert(s >= 0x000c);
|
I_Assert(newversion == DEMOVERSION);
|
||||||
p += 16; // demo checksum
|
p += 16; // demo checksum
|
||||||
I_Assert(!memcmp(p, "PLAY", 4));
|
I_Assert(!memcmp(p, "PLAY", 4));
|
||||||
p += 4; // PLAY
|
p += 4; // PLAY
|
||||||
p += 2; // gamemap
|
p += 2; // gamemap
|
||||||
p += 16; // map md5
|
p += 16; // map md5
|
||||||
flags = READUINT8(p); // demoflags
|
flags = READUINT8(p); // demoflags
|
||||||
G_SkipDemoExtraFiles(&p);
|
G_SkipDemoExtraFiles(&p, newversion);
|
||||||
aflags = flags & (DF_RECORDATTACK|DF_NIGHTSATTACK);
|
aflags = flags & (DF_RECORDATTACK|DF_NIGHTSATTACK);
|
||||||
I_Assert(aflags);
|
I_Assert(aflags);
|
||||||
if (flags & DF_RECORDATTACK)
|
if (flags & DF_RECORDATTACK)
|
||||||
|
@ -1909,7 +1914,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
||||||
p += 2; // gamemap
|
p += 2; // gamemap
|
||||||
p += 16; // mapmd5
|
p += 16; // mapmd5
|
||||||
flags = READUINT8(p);
|
flags = READUINT8(p);
|
||||||
G_SkipDemoExtraFiles(&p);
|
G_SkipDemoExtraFiles(&p, oldversion);
|
||||||
if (!(flags & aflags))
|
if (!(flags & aflags))
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("File '%s' not from same game mode. It will be overwritten.\n"), oldname);
|
CONS_Alert(CONS_NOTICE, M_GetText("File '%s' not from same game mode. It will be overwritten.\n"), oldname);
|
||||||
|
@ -2074,26 +2079,22 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
|
|
||||||
demoflags = READUINT8(demo_p);
|
demoflags = READUINT8(demo_p);
|
||||||
|
|
||||||
if (demoversion < 0x0010)
|
if (titledemo)
|
||||||
{
|
|
||||||
; // Don't do anything with files.
|
|
||||||
}
|
|
||||||
else if (titledemo)
|
|
||||||
{
|
{
|
||||||
// Titledemos should always play and ought to always be compatible with whatever wadlist is running.
|
// Titledemos should always play and ought to always be compatible with whatever wadlist is running.
|
||||||
G_SkipDemoExtraFiles(&demo_p);
|
G_SkipDemoExtraFiles(&demo_p, demoversion);
|
||||||
}
|
}
|
||||||
else if (demofileoverride == DFILE_OVERRIDE_LOAD)
|
else if (demofileoverride == DFILE_OVERRIDE_LOAD)
|
||||||
{
|
{
|
||||||
G_LoadDemoExtraFiles(&demo_p);
|
G_LoadDemoExtraFiles(&demo_p, demoversion);
|
||||||
}
|
}
|
||||||
else if (demofileoverride == DFILE_OVERRIDE_SKIP)
|
else if (demofileoverride == DFILE_OVERRIDE_SKIP)
|
||||||
{
|
{
|
||||||
G_SkipDemoExtraFiles(&demo_p);
|
G_SkipDemoExtraFiles(&demo_p, demoversion);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT8 error = G_CheckDemoExtraFiles(&demo_p, false);
|
UINT8 error = G_CheckDemoExtraFiles(&demo_p, false, demoversion);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
|
@ -2302,6 +2303,13 @@ UINT8 G_CheckDemoForError(char *defdemoname)
|
||||||
{
|
{
|
||||||
lumpnum_t l;
|
lumpnum_t l;
|
||||||
char *n,*pdemoname;
|
char *n,*pdemoname;
|
||||||
|
UINT16 our_demo_version;
|
||||||
|
|
||||||
|
if (titledemo)
|
||||||
|
{
|
||||||
|
// Don't do anything with files for these.
|
||||||
|
return DFILE_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
n = defdemoname+strlen(defdemoname);
|
n = defdemoname+strlen(defdemoname);
|
||||||
while (*n != '/' && *n != '\\' && n != defdemoname)
|
while (*n != '/' && *n != '\\' && n != defdemoname)
|
||||||
|
@ -2340,9 +2348,8 @@ UINT8 G_CheckDemoForError(char *defdemoname)
|
||||||
|
|
||||||
demo_p++; // version
|
demo_p++; // version
|
||||||
demo_p++; // subversion
|
demo_p++; // subversion
|
||||||
demoversion = READUINT16(demo_p);
|
our_demo_version = READUINT16(demo_p);
|
||||||
demo_forwardmove_rng = (demoversion < 0x0010);
|
switch(our_demo_version)
|
||||||
switch(demoversion)
|
|
||||||
{
|
{
|
||||||
case 0x000d:
|
case 0x000d:
|
||||||
case 0x000e:
|
case 0x000e:
|
||||||
|
@ -2368,17 +2375,7 @@ UINT8 G_CheckDemoForError(char *defdemoname)
|
||||||
|
|
||||||
demo_p++; // demoflags
|
demo_p++; // demoflags
|
||||||
|
|
||||||
// Don't do anything with files.
|
return G_CheckDemoExtraFiles(&demo_p, true, our_demo_version);
|
||||||
if (demoversion < 0x0010)
|
|
||||||
{
|
|
||||||
return DFILE_ERROR_NONE;
|
|
||||||
}
|
|
||||||
else if (titledemo)
|
|
||||||
{
|
|
||||||
return DFILE_ERROR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return G_CheckDemoExtraFiles(&demo_p, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_AddGhost(char *defdemoname)
|
void G_AddGhost(char *defdemoname)
|
||||||
|
@ -2487,7 +2484,7 @@ void G_AddGhost(char *defdemoname)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_SkipDemoExtraFiles(&p); // Don't wanna modify the file list for ghosts.
|
G_SkipDemoExtraFiles(&p, ghostversion); // Don't wanna modify the file list for ghosts.
|
||||||
|
|
||||||
switch ((flags & DF_ATTACKMASK)>>DF_ATTACKSHIFT)
|
switch ((flags & DF_ATTACKMASK)>>DF_ATTACKSHIFT)
|
||||||
{
|
{
|
||||||
|
|
59
src/g_game.c
59
src/g_game.c
|
@ -156,6 +156,7 @@ textprompt_t *textprompts[MAX_PROMPTS];
|
||||||
|
|
||||||
INT16 nextmapoverride;
|
INT16 nextmapoverride;
|
||||||
UINT8 skipstats;
|
UINT8 skipstats;
|
||||||
|
INT16 nextgametype = -1;
|
||||||
|
|
||||||
// Pointers to each CTF flag
|
// Pointers to each CTF flag
|
||||||
mobj_t *redflag;
|
mobj_t *redflag;
|
||||||
|
@ -2137,7 +2138,7 @@ boolean G_Responder(event_t *ev)
|
||||||
if (! netgame)
|
if (! netgame)
|
||||||
F_StartGameEvaluation();
|
F_StartGameEvaluation();
|
||||||
else if (server || IsPlayerAdmin(consoleplayer))
|
else if (server || IsPlayerAdmin(consoleplayer))
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2523,7 +2524,6 @@ static inline void G_PlayerFinishLevel(INT32 player)
|
||||||
|
|
||||||
memset(p->powers, 0, sizeof (p->powers));
|
memset(p->powers, 0, sizeof (p->powers));
|
||||||
p->ringweapons = 0;
|
p->ringweapons = 0;
|
||||||
p->recordscore = 0;
|
|
||||||
|
|
||||||
p->mo->flags2 &= ~MF2_SHADOW; // cancel invisibility
|
p->mo->flags2 &= ~MF2_SHADOW; // cancel invisibility
|
||||||
P_FlashPal(p, 0, 0); // Resets
|
P_FlashPal(p, 0, 0); // Resets
|
||||||
|
@ -3462,9 +3462,7 @@ UINT32 gametypedefaultrules[NUMGAMETYPES] =
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// G_SetGametype
|
// Sets a new gametype.
|
||||||
//
|
|
||||||
// Set a new gametype, also setting gametype rules accordingly. Yay!
|
|
||||||
//
|
//
|
||||||
void G_SetGametype(INT16 gtype)
|
void G_SetGametype(INT16 gtype)
|
||||||
{
|
{
|
||||||
|
@ -3862,7 +3860,7 @@ static INT16 RandMap(UINT32 tolflags, INT16 pprevmap)
|
||||||
for (ix = 0; ix < NUMMAPS; ix++)
|
for (ix = 0; ix < NUMMAPS; ix++)
|
||||||
if (mapheaderinfo[ix] && (mapheaderinfo[ix]->typeoflevel & tolflags) == tolflags
|
if (mapheaderinfo[ix] && (mapheaderinfo[ix]->typeoflevel & tolflags) == tolflags
|
||||||
&& ix != pprevmap // Don't pick the same map.
|
&& ix != pprevmap // Don't pick the same map.
|
||||||
&& (dedicated || !M_MapLocked(ix+1, serverGamedata)) // Don't pick locked maps.
|
&& (!M_MapLocked(ix+1, serverGamedata)) // Don't pick locked maps.
|
||||||
)
|
)
|
||||||
okmaps[numokmaps++] = ix;
|
okmaps[numokmaps++] = ix;
|
||||||
|
|
||||||
|
@ -4054,6 +4052,13 @@ static void G_DoCompleted(void)
|
||||||
nextmap = 1100-1; // No infinite loop for you
|
nextmap = 1100-1; // No infinite loop for you
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT16 gametype_to_use;
|
||||||
|
|
||||||
|
if (nextgametype >= 0 && nextgametype < gametypecount)
|
||||||
|
gametype_to_use = nextgametype;
|
||||||
|
else
|
||||||
|
gametype_to_use = gametype;
|
||||||
|
|
||||||
// If nextmap is actually going to get used, make sure it points to
|
// If nextmap is actually going to get used, make sure it points to
|
||||||
// a map of the proper gametype -- skip levels that don't support
|
// a map of the proper gametype -- skip levels that don't support
|
||||||
// the current gametype. (Helps avoid playing boss levels in Race,
|
// the current gametype. (Helps avoid playing boss levels in Race,
|
||||||
|
@ -4062,8 +4067,8 @@ static void G_DoCompleted(void)
|
||||||
{
|
{
|
||||||
if (nextmap >= 0 && nextmap < NUMMAPS)
|
if (nextmap >= 0 && nextmap < NUMMAPS)
|
||||||
{
|
{
|
||||||
register INT16 cm = nextmap;
|
INT16 cm = nextmap;
|
||||||
UINT32 tolflag = G_TOLFlag(gametype);
|
UINT32 tolflag = G_TOLFlag(gametype_to_use);
|
||||||
UINT8 visitedmap[(NUMMAPS+7)/8];
|
UINT8 visitedmap[(NUMMAPS+7)/8];
|
||||||
|
|
||||||
memset(visitedmap, 0, sizeof (visitedmap));
|
memset(visitedmap, 0, sizeof (visitedmap));
|
||||||
|
@ -4143,7 +4148,7 @@ static void G_DoCompleted(void)
|
||||||
if (cv_advancemap.value == 0) // Stay on same map.
|
if (cv_advancemap.value == 0) // Stay on same map.
|
||||||
nextmap = prevmap;
|
nextmap = prevmap;
|
||||||
else if (cv_advancemap.value == 2) // Go to random map.
|
else if (cv_advancemap.value == 2) // Go to random map.
|
||||||
nextmap = RandMap(G_TOLFlag(gametype), prevmap);
|
nextmap = RandMap(G_TOLFlag(gametype_to_use), prevmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are committed to this map now.
|
// We are committed to this map now.
|
||||||
|
@ -4152,7 +4157,6 @@ static void G_DoCompleted(void)
|
||||||
if (nextmap < NUMMAPS && !mapheaderinfo[nextmap])
|
if (nextmap < NUMMAPS && !mapheaderinfo[nextmap])
|
||||||
P_AllocMapHeader(nextmap);
|
P_AllocMapHeader(nextmap);
|
||||||
|
|
||||||
// If the current gametype has no intermission screen set, then don't start it.
|
|
||||||
Y_DetermineIntermissionType();
|
Y_DetermineIntermissionType();
|
||||||
|
|
||||||
if ((skipstats && !modeattacking) || (modeattacking && stagefailed) || (intertype == int_none))
|
if ((skipstats && !modeattacking) || (modeattacking && stagefailed) || (intertype == int_none))
|
||||||
|
@ -4218,12 +4222,21 @@ static void G_DoWorldDone(void)
|
||||||
{
|
{
|
||||||
if (server)
|
if (server)
|
||||||
{
|
{
|
||||||
|
INT16 gametype_to_use;
|
||||||
|
|
||||||
|
if (nextgametype >= 0 && nextgametype < gametypecount)
|
||||||
|
gametype_to_use = nextgametype;
|
||||||
|
else
|
||||||
|
gametype_to_use = gametype;
|
||||||
|
|
||||||
if (gametyperules & GTR_CAMPAIGN)
|
if (gametyperules & GTR_CAMPAIGN)
|
||||||
// don't reset player between maps
|
// don't reset player between maps
|
||||||
D_MapChange(nextmap+1, gametype, ultimatemode, false, 0, false, false);
|
D_MapChange(nextmap+1, gametype_to_use, ultimatemode, false, 0, false, false);
|
||||||
else
|
else
|
||||||
// resetplayer in match/chaos/tag/CTF/race for more equality
|
// resetplayer in match/chaos/tag/CTF/race for more equality
|
||||||
D_MapChange(nextmap+1, gametype, ultimatemode, true, 0, false, false);
|
D_MapChange(nextmap+1, gametype_to_use, ultimatemode, true, 0, false, false);
|
||||||
|
|
||||||
|
nextgametype = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameaction = ga_nothing;
|
gameaction = ga_nothing;
|
||||||
|
@ -4266,7 +4279,7 @@ static void G_DoContinued(void)
|
||||||
{
|
{
|
||||||
player_t *pl = &players[consoleplayer];
|
player_t *pl = &players[consoleplayer];
|
||||||
I_Assert(!netgame && !multiplayer);
|
I_Assert(!netgame && !multiplayer);
|
||||||
I_Assert(pl->continues > 0);
|
//I_Assert(pl->continues > 0);
|
||||||
|
|
||||||
if (pl->continues)
|
if (pl->continues)
|
||||||
pl->continues--;
|
pl->continues--;
|
||||||
|
@ -5048,6 +5061,12 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
numgameovers = tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
|
numgameovers = tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
|
||||||
countdown = countdown2 = exitfadestarted = 0;
|
countdown = countdown2 = exitfadestarted = 0;
|
||||||
|
|
||||||
|
if (!FLS)
|
||||||
|
{
|
||||||
|
emeralds = 0;
|
||||||
|
memset(&luabanks, 0, sizeof(luabanks));
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
players[i].playerstate = PST_REBORN;
|
players[i].playerstate = PST_REBORN;
|
||||||
|
@ -5055,6 +5074,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
players[i].starpostx = players[i].starposty = players[i].starpostz = 0;
|
players[i].starpostx = players[i].starposty = players[i].starpostz = 0;
|
||||||
players[i].recordscore = 0;
|
players[i].recordscore = 0;
|
||||||
|
|
||||||
|
// default lives, continues and score
|
||||||
if (netgame || multiplayer)
|
if (netgame || multiplayer)
|
||||||
{
|
{
|
||||||
if (!FLS || (players[i].lives < 1))
|
if (!FLS || (players[i].lives < 1))
|
||||||
|
@ -5114,6 +5134,19 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
automapactive = false;
|
automapactive = false;
|
||||||
imcontinuing = false;
|
imcontinuing = false;
|
||||||
|
|
||||||
|
// fetch saved data if available
|
||||||
|
if (savedata.lives > 0)
|
||||||
|
{
|
||||||
|
numgameovers = savedata.numgameovers;
|
||||||
|
players[consoleplayer].continues = savedata.continues;
|
||||||
|
players[consoleplayer].lives = savedata.lives;
|
||||||
|
players[consoleplayer].score = savedata.score;
|
||||||
|
if ((botingame = ((botskin = savedata.botskin) != 0)))
|
||||||
|
botcolor = skins[botskin-1].prefcolor;
|
||||||
|
emeralds = savedata.emeralds;
|
||||||
|
savedata.lives = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((gametyperules & GTR_CUTSCENES) && !skipprecutscene && mapheaderinfo[gamemap-1]->precutscenenum && !modeattacking && !(marathonmode & MA_NOCUTSCENES)) // Start a custom cutscene.
|
if ((gametyperules & GTR_CUTSCENES) && !skipprecutscene && mapheaderinfo[gamemap-1]->precutscenenum && !modeattacking && !(marathonmode & MA_NOCUTSCENES)) // Start a custom cutscene.
|
||||||
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer, FLS);
|
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer, FLS);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1 +1,14 @@
|
||||||
target_sourcefile(c)
|
target_sources(SRB2SDL2 PRIVATE
|
||||||
|
hw_bsp.c
|
||||||
|
hw_draw.c
|
||||||
|
hw_light.c
|
||||||
|
hw_main.c
|
||||||
|
hw_clip.c
|
||||||
|
hw_md2.c
|
||||||
|
hw_cache.c
|
||||||
|
hw_md2load.c
|
||||||
|
hw_md3load.c
|
||||||
|
hw_model.c
|
||||||
|
hw_batching.c
|
||||||
|
r_opengl/r_opengl.c
|
||||||
|
)
|
||||||
|
|
|
@ -1146,7 +1146,7 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendpatch, INT32 ski
|
||||||
static boolean HWR_AllowModel(mobj_t *mobj)
|
static boolean HWR_AllowModel(mobj_t *mobj)
|
||||||
{
|
{
|
||||||
// Signpost overlay. Not needed.
|
// Signpost overlay. Not needed.
|
||||||
if (mobj->state-states == S_PLAY_SIGN)
|
if (mobj->sprite2 == SPR2_SIGN || mobj->state-states == S_PLAY_SIGN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Otherwise, render the model.
|
// Otherwise, render the model.
|
||||||
|
|
|
@ -159,7 +159,7 @@ HMS_connect (const char *format, ...)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_masterserver_token.string[0])
|
if (cv_masterserver_token.string && cv_masterserver_token.string[0])
|
||||||
{
|
{
|
||||||
quack_token = curl_easy_escape(curl, cv_masterserver_token.string, 0);
|
quack_token = curl_easy_escape(curl, cv_masterserver_token.string, 0);
|
||||||
token_length = ( sizeof "?token="-1 )+ strlen(quack_token);
|
token_length = ( sizeof "?token="-1 )+ strlen(quack_token);
|
||||||
|
|
|
@ -2456,7 +2456,7 @@ static int lib_pFadeLight(lua_State *L)
|
||||||
static int lib_pIsFlagAtBase(lua_State *L)
|
static int lib_pIsFlagAtBase(lua_State *L)
|
||||||
{
|
{
|
||||||
mobjtype_t flag = luaL_checkinteger(L, 1);
|
mobjtype_t flag = luaL_checkinteger(L, 1);
|
||||||
NOHUD
|
//HUDSAFE
|
||||||
INLEVEL
|
INLEVEL
|
||||||
if (flag >= NUMMOBJTYPES)
|
if (flag >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", flag, NUMMOBJTYPES-1);
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", flag, NUMMOBJTYPES-1);
|
||||||
|
@ -3826,7 +3826,7 @@ static int lib_gDoReborn(lua_State *L)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Another Lua function that doesn't actually exist!
|
// Another Lua function that doesn't actually exist!
|
||||||
// Sets nextmapoverride & skipstats without instantly ending the level, for instances where other sources should be exiting the level, like normal signposts.
|
// Sets nextmapoverride, skipstats and nextgametype without instantly ending the level, for instances where other sources should be exiting the level, like normal signposts.
|
||||||
static int lib_gSetCustomExitVars(lua_State *L)
|
static int lib_gSetCustomExitVars(lua_State *L)
|
||||||
{
|
{
|
||||||
int n = lua_gettop(L); // Num arguments
|
int n = lua_gettop(L); // Num arguments
|
||||||
|
@ -3835,18 +3835,21 @@ static int lib_gSetCustomExitVars(lua_State *L)
|
||||||
|
|
||||||
// LUA EXTENSION: Custom exit like support
|
// LUA EXTENSION: Custom exit like support
|
||||||
// Supported:
|
// Supported:
|
||||||
// G_SetCustomExitVars(); [reset to defaults]
|
// G_SetCustomExitVars(); [reset to defaults]
|
||||||
// G_SetCustomExitVars(int) [nextmap override only]
|
// G_SetCustomExitVars(int) [nextmap override only]
|
||||||
// G_SetCustomExitVars(nil, int) [skipstats only]
|
// G_SetCustomExitVars(nil, int) [skipstats only]
|
||||||
// G_SetCustomExitVars(int, int) [both of the above]
|
// G_SetCustomExitVars(int, int) [both of the above]
|
||||||
|
// G_SetCustomExitVars(int, int, int) [nextmapoverride, skipstats and nextgametype]
|
||||||
|
|
||||||
nextmapoverride = 0;
|
nextmapoverride = 0;
|
||||||
skipstats = 0;
|
skipstats = 0;
|
||||||
|
nextgametype = -1;
|
||||||
|
|
||||||
if (n >= 1)
|
if (n >= 1)
|
||||||
{
|
{
|
||||||
nextmapoverride = (INT16)luaL_optinteger(L, 1, 0);
|
nextmapoverride = (INT16)luaL_optinteger(L, 1, 0);
|
||||||
skipstats = (INT16)luaL_optinteger(L, 2, 0);
|
skipstats = (INT16)luaL_optinteger(L, 2, 0);
|
||||||
|
nextgametype = (INT16)luaL_optinteger(L, 3, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1487,7 +1487,6 @@ void LUA_SetHudHook(int hook, huddrawlist_h list)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HUD_HOOK(intermission):
|
case HUD_HOOK(intermission):
|
||||||
lua_pushboolean(gL, intertype == int_spec &&
|
lua_pushboolean(gL, stagefailed);
|
||||||
stagefailed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -508,8 +508,6 @@ static int pivotlist_get(lua_State *L)
|
||||||
const char *field = luaL_checkstring(L, 2);
|
const char *field = luaL_checkstring(L, 2);
|
||||||
UINT8 frame;
|
UINT8 frame;
|
||||||
|
|
||||||
I_Assert(framepivot != NULL);
|
|
||||||
|
|
||||||
frame = R_Char2Frame(field[0]);
|
frame = R_Char2Frame(field[0]);
|
||||||
if (frame == 255)
|
if (frame == 255)
|
||||||
luaL_error(L, "invalid frame %s", field);
|
luaL_error(L, "invalid frame %s", field);
|
||||||
|
@ -539,8 +537,6 @@ static int pivotlist_set(lua_State *L)
|
||||||
if (hook_cmd_running)
|
if (hook_cmd_running)
|
||||||
return luaL_error(L, "Do not alter spriteframepivot_t in CMD building code!");
|
return luaL_error(L, "Do not alter spriteframepivot_t in CMD building code!");
|
||||||
|
|
||||||
I_Assert(pivotlist != NULL);
|
|
||||||
|
|
||||||
frame = R_Char2Frame(field[0]);
|
frame = R_Char2Frame(field[0]);
|
||||||
if (frame == 255)
|
if (frame == 255)
|
||||||
luaL_error(L, "invalid frame %s", field);
|
luaL_error(L, "invalid frame %s", field);
|
||||||
|
|
|
@ -925,6 +925,8 @@ enum mapthing_e {
|
||||||
mapthing_type,
|
mapthing_type,
|
||||||
mapthing_options,
|
mapthing_options,
|
||||||
mapthing_scale,
|
mapthing_scale,
|
||||||
|
mapthing_spritexscale,
|
||||||
|
mapthing_spriteyscale,
|
||||||
mapthing_z,
|
mapthing_z,
|
||||||
mapthing_extrainfo,
|
mapthing_extrainfo,
|
||||||
mapthing_tag,
|
mapthing_tag,
|
||||||
|
@ -944,6 +946,8 @@ const char *const mapthing_opt[] = {
|
||||||
"type",
|
"type",
|
||||||
"options",
|
"options",
|
||||||
"scale",
|
"scale",
|
||||||
|
"spritexscale",
|
||||||
|
"spriteyscale",
|
||||||
"z",
|
"z",
|
||||||
"extrainfo",
|
"extrainfo",
|
||||||
"tag",
|
"tag",
|
||||||
|
@ -999,7 +1003,13 @@ static int mapthing_get(lua_State *L)
|
||||||
lua_pushinteger(L, mt->options);
|
lua_pushinteger(L, mt->options);
|
||||||
break;
|
break;
|
||||||
case mapthing_scale:
|
case mapthing_scale:
|
||||||
lua_pushinteger(L, mt->scale);
|
lua_pushfixed(L, mt->scale);
|
||||||
|
break;
|
||||||
|
case mapthing_spritexscale:
|
||||||
|
lua_pushfixed(L, mt->spritexscale);
|
||||||
|
break;
|
||||||
|
case mapthing_spriteyscale:
|
||||||
|
lua_pushfixed(L, mt->spriteyscale);
|
||||||
break;
|
break;
|
||||||
case mapthing_z:
|
case mapthing_z:
|
||||||
lua_pushinteger(L, mt->z);
|
lua_pushinteger(L, mt->z);
|
||||||
|
@ -1072,6 +1082,12 @@ static int mapthing_set(lua_State *L)
|
||||||
case mapthing_scale:
|
case mapthing_scale:
|
||||||
mt->scale = luaL_checkfixed(L, 3);
|
mt->scale = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
|
case mapthing_spritexscale:
|
||||||
|
mt->spritexscale = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
|
case mapthing_spriteyscale:
|
||||||
|
mt->spriteyscale = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
case mapthing_z:
|
case mapthing_z:
|
||||||
mt->z = (INT16)luaL_checkinteger(L, 3);
|
mt->z = (INT16)luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -225,6 +225,18 @@ int LUA_PushGlobals(lua_State *L, const char *word)
|
||||||
} else if (fastcmp(word,"pointlimit")) {
|
} else if (fastcmp(word,"pointlimit")) {
|
||||||
lua_pushinteger(L, cv_pointlimit.value);
|
lua_pushinteger(L, cv_pointlimit.value);
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (fastcmp(word, "redflag")) {
|
||||||
|
LUA_PushUserdata(L, redflag, META_MOBJ);
|
||||||
|
return 1;
|
||||||
|
} else if (fastcmp(word, "blueflag")) {
|
||||||
|
LUA_PushUserdata(L, blueflag, META_MOBJ);
|
||||||
|
return 1;
|
||||||
|
} else if (fastcmp(word, "rflagpoint")) {
|
||||||
|
LUA_PushUserdata(L, rflagpoint, META_MAPTHING);
|
||||||
|
return 1;
|
||||||
|
} else if (fastcmp(word, "bflagpoint")) {
|
||||||
|
LUA_PushUserdata(L, bflagpoint, META_MAPTHING);
|
||||||
|
return 1;
|
||||||
// begin map vars
|
// begin map vars
|
||||||
} else if (fastcmp(word,"spstage_start")) {
|
} else if (fastcmp(word,"spstage_start")) {
|
||||||
lua_pushinteger(L, spstage_start);
|
lua_pushinteger(L, spstage_start);
|
||||||
|
@ -977,6 +989,7 @@ enum
|
||||||
ARCH_MAPHEADER,
|
ARCH_MAPHEADER,
|
||||||
ARCH_SKINCOLOR,
|
ARCH_SKINCOLOR,
|
||||||
ARCH_MOUSE,
|
ARCH_MOUSE,
|
||||||
|
ARCH_SKIN,
|
||||||
|
|
||||||
ARCH_TEND=0xFF,
|
ARCH_TEND=0xFF,
|
||||||
};
|
};
|
||||||
|
@ -1005,6 +1018,7 @@ static const struct {
|
||||||
{META_MAPHEADER, ARCH_MAPHEADER},
|
{META_MAPHEADER, ARCH_MAPHEADER},
|
||||||
{META_SKINCOLOR, ARCH_SKINCOLOR},
|
{META_SKINCOLOR, ARCH_SKINCOLOR},
|
||||||
{META_MOUSE, ARCH_MOUSE},
|
{META_MOUSE, ARCH_MOUSE},
|
||||||
|
{META_SKIN, ARCH_SKIN},
|
||||||
{NULL, ARCH_NULL}
|
{NULL, ARCH_NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1326,6 +1340,13 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
||||||
WRITEUINT8(save_p, m == &mouse ? 1 : 2);
|
WRITEUINT8(save_p, m == &mouse ? 1 : 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ARCH_SKIN:
|
||||||
|
{
|
||||||
|
skin_t *skin = *((skin_t **)lua_touserdata(gL, myindex));
|
||||||
|
WRITEUINT8(save_p, ARCH_SKIN);
|
||||||
|
WRITEUINT8(save_p, skin - skins); // UINT8 because MAXSKINS is only 32
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
WRITEUINT8(save_p, ARCH_NULL);
|
WRITEUINT8(save_p, ARCH_NULL);
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -1572,6 +1593,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
||||||
case ARCH_MOUSE:
|
case ARCH_MOUSE:
|
||||||
LUA_PushUserdata(gL, READUINT16(save_p) == 1 ? &mouse : &mouse2, META_MOUSE);
|
LUA_PushUserdata(gL, READUINT16(save_p) == 1 ? &mouse : &mouse2, META_MOUSE);
|
||||||
break;
|
break;
|
||||||
|
case ARCH_SKIN:
|
||||||
|
LUA_PushUserdata(gL, &skins[READUINT8(save_p)], META_SKIN);
|
||||||
|
break;
|
||||||
case ARCH_TEND:
|
case ARCH_TEND:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
53
src/m_cond.c
53
src/m_cond.c
|
@ -113,7 +113,7 @@ void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1
|
||||||
condition_t *cond;
|
condition_t *cond;
|
||||||
UINT32 num, wnum;
|
UINT32 num, wnum;
|
||||||
|
|
||||||
I_Assert(set && set <= MAXCONDITIONSETS);
|
I_Assert(set < MAXCONDITIONSETS);
|
||||||
|
|
||||||
wnum = conditionSets[set - 1].numconditions;
|
wnum = conditionSets[set - 1].numconditions;
|
||||||
num = ++conditionSets[set - 1].numconditions;
|
num = ++conditionSets[set - 1].numconditions;
|
||||||
|
@ -467,6 +467,15 @@ UINT8 M_SecretUnlocked(INT32 type, gamedata_t *data)
|
||||||
|
|
||||||
UINT8 M_MapLocked(INT32 mapnum, gamedata_t *data)
|
UINT8 M_MapLocked(INT32 mapnum, gamedata_t *data)
|
||||||
{
|
{
|
||||||
|
if (dedicated)
|
||||||
|
{
|
||||||
|
// If you're in a dedicated server, every level is unlocked.
|
||||||
|
// Yes, technically this means you can view any level by
|
||||||
|
// running a dedicated server and joining it yourself, but
|
||||||
|
// that's better than making dedicated server's lives hell.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mapheaderinfo[mapnum-1] || mapheaderinfo[mapnum-1]->unlockrequired < 0)
|
if (!mapheaderinfo[mapnum-1] || mapheaderinfo[mapnum-1]->unlockrequired < 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -480,6 +489,48 @@ UINT8 M_MapLocked(INT32 mapnum, gamedata_t *data)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT8 M_CampaignWarpIsCheat(INT32 gt, INT32 mapnum, gamedata_t *data)
|
||||||
|
{
|
||||||
|
if (M_MapLocked(mapnum, data) == true)
|
||||||
|
{
|
||||||
|
// Warping to locked maps is definitely always a cheat
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((gametypedefaultrules[gt] & GTR_CAMPAIGN) == 0)
|
||||||
|
{
|
||||||
|
// Not a campaign, do whatever you want.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (G_IsSpecialStage(mapnum))
|
||||||
|
{
|
||||||
|
// Warping to special stages is a cheat
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapheaderinfo[mapnum-1]->menuflags & LF2_HIDEINMENU)
|
||||||
|
{
|
||||||
|
// You're never allowed to warp to this level.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapheaderinfo[mapnum-1]->menuflags & LF2_NOVISITNEEDED)
|
||||||
|
{
|
||||||
|
// You're always allowed to warp to this level.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapnum == spstage_start)
|
||||||
|
{
|
||||||
|
// Warping to the first level is never a cheat
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's only a cheat if you've never been there.
|
||||||
|
return (!(data->mapvisited[mapnum]));
|
||||||
|
}
|
||||||
|
|
||||||
INT32 M_CountEmblems(gamedata_t *data)
|
INT32 M_CountEmblems(gamedata_t *data)
|
||||||
{
|
{
|
||||||
INT32 found = 0, i;
|
INT32 found = 0, i;
|
||||||
|
|
|
@ -252,6 +252,7 @@ void M_SilentUpdateSkinAvailabilites(void);
|
||||||
UINT8 M_AnySecretUnlocked(gamedata_t *data);
|
UINT8 M_AnySecretUnlocked(gamedata_t *data);
|
||||||
UINT8 M_SecretUnlocked(INT32 type, gamedata_t *data);
|
UINT8 M_SecretUnlocked(INT32 type, gamedata_t *data);
|
||||||
UINT8 M_MapLocked(INT32 mapnum, gamedata_t *data);
|
UINT8 M_MapLocked(INT32 mapnum, gamedata_t *data);
|
||||||
|
UINT8 M_CampaignWarpIsCheat(INT32 gt, INT32 mapnum, gamedata_t *data);
|
||||||
INT32 M_CountEmblems(gamedata_t *data);
|
INT32 M_CountEmblems(gamedata_t *data);
|
||||||
|
|
||||||
// Emblem shit
|
// Emblem shit
|
||||||
|
|
|
@ -21,50 +21,6 @@
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
|
|
||||||
#ifdef __USE_C_FIXEDMUL__
|
|
||||||
|
|
||||||
/** \brief The FixedMul function
|
|
||||||
|
|
||||||
\param a fixed_t number
|
|
||||||
\param b fixed_t number
|
|
||||||
|
|
||||||
\return a*b>>FRACBITS
|
|
||||||
|
|
||||||
*/
|
|
||||||
fixed_t FixedMul(fixed_t a, fixed_t b)
|
|
||||||
{
|
|
||||||
// Need to cast to unsigned before shifting to avoid undefined behaviour
|
|
||||||
// for negative integers
|
|
||||||
return (fixed_t)(((UINT64)((INT64)a * b)) >> FRACBITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //__USE_C_FIXEDMUL__
|
|
||||||
|
|
||||||
#ifdef __USE_C_FIXEDDIV__
|
|
||||||
/** \brief The FixedDiv2 function
|
|
||||||
|
|
||||||
\param a fixed_t number
|
|
||||||
\param b fixed_t number
|
|
||||||
|
|
||||||
\return a/b * FRACUNIT
|
|
||||||
|
|
||||||
*/
|
|
||||||
fixed_t FixedDiv2(fixed_t a, fixed_t b)
|
|
||||||
{
|
|
||||||
INT64 ret;
|
|
||||||
|
|
||||||
if (b == 0)
|
|
||||||
I_Error("FixedDiv: divide by zero");
|
|
||||||
|
|
||||||
ret = (((INT64)a * FRACUNIT)) / b;
|
|
||||||
|
|
||||||
if ((ret > INT32_MAX) || (ret < INT32_MIN))
|
|
||||||
I_Error("FixedDiv: divide by zero");
|
|
||||||
return (fixed_t)ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __USE_C_FIXEDDIV__
|
|
||||||
|
|
||||||
fixed_t FixedSqrt(fixed_t x)
|
fixed_t FixedSqrt(fixed_t x)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SQRT
|
#ifdef HAVE_SQRT
|
||||||
|
|
136
src/m_fixed.h
136
src/m_fixed.h
|
@ -53,127 +53,35 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f)
|
||||||
#define FIXED_TO_FLOAT(x) FixedToFloat(x) // (((float)(x)) / ((float)FRACUNIT))
|
#define FIXED_TO_FLOAT(x) FixedToFloat(x) // (((float)(x)) / ((float)FRACUNIT))
|
||||||
#define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT))
|
#define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT))
|
||||||
|
|
||||||
|
/** \brief The FixedMul function
|
||||||
|
|
||||||
#if defined (__WATCOMC__) && FRACBITS == 16
|
\param a fixed_t number
|
||||||
#pragma aux FixedMul = \
|
\param b fixed_t number
|
||||||
"imul ebx", \
|
|
||||||
"shrd eax,edx,16" \
|
|
||||||
parm [eax] [ebx] \
|
|
||||||
value [eax] \
|
|
||||||
modify exact [eax edx]
|
|
||||||
|
|
||||||
#pragma aux FixedDiv2 = \
|
\return a*b>>FRACBITS
|
||||||
"cdq", \
|
|
||||||
"shld edx,eax,16", \
|
|
||||||
"sal eax,16", \
|
|
||||||
"idiv ebx" \
|
|
||||||
parm [eax] [ebx] \
|
|
||||||
value [eax] \
|
|
||||||
modify exact [eax edx]
|
|
||||||
#elif defined (__GNUC__) && defined (__i386__) && !defined (NOASM)
|
|
||||||
// i386 linux, cygwin or mingw
|
|
||||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // asm
|
|
||||||
{
|
|
||||||
fixed_t ret;
|
|
||||||
asm
|
|
||||||
(
|
|
||||||
"imull %2;" // a*b
|
|
||||||
"shrdl %3,%%edx,%0;" // shift logical right FRACBITS bits
|
|
||||||
:"=a" (ret) // eax is always the result and the first operand (%0,%1)
|
|
||||||
:"0" (a), "r" (b) // and %2 is what we use imull on with what in %1
|
|
||||||
, "I" (FRACBITS) // %3 holds FRACBITS (normally 16)
|
|
||||||
:"cc", "%edx" // edx and condition codes clobbered
|
|
||||||
);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCMATH FUNCINLINE static inline fixed_t FixedDiv2(fixed_t a, fixed_t b)
|
*/
|
||||||
{
|
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedMul(fixed_t a, fixed_t b)
|
||||||
fixed_t ret;
|
{
|
||||||
asm
|
// Need to cast to unsigned before shifting to avoid undefined behaviour
|
||||||
(
|
// for negative integers
|
||||||
"movl %1,%%edx;" // these two instructions allow the next two to pair, on the Pentium processor.
|
return (fixed_t)(((UINT64)((INT64)a * b)) >> FRACBITS);
|
||||||
"sarl $31,%%edx;" // shift arithmetic right 31 on EDX
|
}
|
||||||
"shldl %3,%1,%%edx;" // DP shift logical left FRACBITS on EDX
|
|
||||||
"sall %3,%0;" // shift arithmetic left FRACBITS on EAX
|
|
||||||
"idivl %2;" // EDX/b = EAX
|
|
||||||
: "=a" (ret)
|
|
||||||
: "0" (a), "r" (b)
|
|
||||||
, "I" (FRACBITS)
|
|
||||||
: "%edx"
|
|
||||||
);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#elif defined (__GNUC__) && defined (__arm__) && !defined(__thumb__) && !defined(NOASM) //ARMv4 ASM
|
|
||||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // let abuse smull
|
|
||||||
{
|
|
||||||
fixed_t ret;
|
|
||||||
asm
|
|
||||||
(
|
|
||||||
"smull %[lo], r1, %[a], %[b];"
|
|
||||||
"mov %[lo], %[lo], lsr %3;"
|
|
||||||
"orr %[lo], %[lo], r1, lsl %3;"
|
|
||||||
: [lo] "=&r" (ret) // rhi, rlo and rm must be distinct registers
|
|
||||||
: [a] "r" (a), [b] "r" (b)
|
|
||||||
, "i" (FRACBITS)
|
|
||||||
: "r1"
|
|
||||||
);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define __USE_C_FIXEDDIV__ // no double or asm div in ARM land
|
/** \brief The FixedDiv2 function
|
||||||
#elif defined (__GNUC__) && defined (__ppc__) && !defined(NOASM) && 0 // WII: PPC CPU
|
|
||||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // asm
|
|
||||||
{
|
|
||||||
fixed_t ret, hi, lo;
|
|
||||||
asm
|
|
||||||
(
|
|
||||||
"mullw %0, %2, %3;"
|
|
||||||
"mulhw %1, %2, %3"
|
|
||||||
: "=r" (hi), "=r" (lo)
|
|
||||||
: "r" (a), "r" (b)
|
|
||||||
, "I" (FRACBITS)
|
|
||||||
);
|
|
||||||
ret = (INT64)((hi>>FRACBITS)+lo)<<FRACBITS;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define __USE_C_FIXEDDIV__// Alam: I am lazy
|
\param a fixed_t number
|
||||||
#elif defined (__GNUC__) && defined (__mips__) && !defined(NOASM) && 0 // PSP: MIPS CPU
|
\param b fixed_t number
|
||||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // asm
|
|
||||||
{
|
|
||||||
fixed_t ret;
|
|
||||||
asm
|
|
||||||
(
|
|
||||||
"mult %3, %4;" // a*b=h<32+l
|
|
||||||
: "=r" (ret), "=l" (a), "=h" (b) //todo: abuse shr opcode
|
|
||||||
: "0" (a), "r" (b)
|
|
||||||
, "I" (FRACBITS)
|
|
||||||
//: "+l", "+h"
|
|
||||||
);
|
|
||||||
ret = (INT64)((a>>FRACBITS)+b)<<FRACBITS;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define __USE_C_FIXEDDIV__ // no 64b asm div in MIPS land
|
\return a/b * FRACUNIT
|
||||||
#elif defined (__GNUC__) && defined (__sh__) && 0 // DC: SH4 CPU
|
|
||||||
#elif defined (__GNUC__) && defined (__m68k__) && 0 // DEAD: Motorola 6800 CPU
|
|
||||||
#elif defined (_MSC_VER) && defined(USEASM) && FRACBITS == 16
|
|
||||||
// Microsoft Visual C++ (no asm inline)
|
|
||||||
fixed_t __cdecl FixedMul(fixed_t a, fixed_t b);
|
|
||||||
fixed_t __cdecl FixedDiv2(fixed_t a, fixed_t b);
|
|
||||||
#else
|
|
||||||
#define __USE_C_FIXEDMUL__
|
|
||||||
#define __USE_C_FIXEDDIV__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __USE_C_FIXEDMUL__
|
*/
|
||||||
FUNCMATH fixed_t FixedMul(fixed_t a, fixed_t b);
|
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv2(fixed_t a, fixed_t b)
|
||||||
#endif
|
{
|
||||||
|
// This does not check for division overflow or division by 0!
|
||||||
#ifdef __USE_C_FIXEDDIV__
|
// That is the caller's responsibility.
|
||||||
FUNCMATH fixed_t FixedDiv2(fixed_t a, fixed_t b);
|
return (fixed_t)(((INT64)a * FRACUNIT) / b);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
/** \brief The FixedInt function
|
/** \brief The FixedInt function
|
||||||
|
|
||||||
|
|
20
src/m_menu.c
20
src/m_menu.c
|
@ -7100,9 +7100,6 @@ static void M_DestroyRobots(INT32 choice)
|
||||||
|
|
||||||
static void M_LevelSelectWarp(INT32 choice)
|
static void M_LevelSelectWarp(INT32 choice)
|
||||||
{
|
{
|
||||||
boolean fromloadgame = (currentMenu == &SP_LevelSelectDef);
|
|
||||||
boolean frompause = (currentMenu == &SP_PauseLevelSelectDef);
|
|
||||||
|
|
||||||
(void)choice;
|
(void)choice;
|
||||||
|
|
||||||
if (W_CheckNumForName(G_BuildMapName(cv_nextmap.value)) == LUMPERROR)
|
if (W_CheckNumForName(G_BuildMapName(cv_nextmap.value)) == LUMPERROR)
|
||||||
|
@ -7114,13 +7111,11 @@ static void M_LevelSelectWarp(INT32 choice)
|
||||||
startmap = (INT16)(cv_nextmap.value);
|
startmap = (INT16)(cv_nextmap.value);
|
||||||
fromlevelselect = true;
|
fromlevelselect = true;
|
||||||
|
|
||||||
if (fromloadgame)
|
if (currentMenu == &SP_LevelSelectDef || currentMenu == &SP_PauseLevelSelectDef)
|
||||||
G_LoadGame((UINT32)cursaveslot, startmap);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
cursaveslot = 0;
|
if (cursaveslot > 0) // do we have a save slot to load?
|
||||||
|
G_LoadGame((UINT32)cursaveslot, startmap); // reload from SP save data: this is needed to keep score/lives/continues from reverting to defaults
|
||||||
if (frompause)
|
else // no save slot, start new game but keep the current skin
|
||||||
{
|
{
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
|
|
||||||
|
@ -7131,8 +7126,11 @@ static void M_LevelSelectWarp(INT32 choice)
|
||||||
Z_Free(levelselect.rows);
|
Z_Free(levelselect.rows);
|
||||||
levelselect.rows = NULL;
|
levelselect.rows = NULL;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
M_SetupChoosePlayer(0);
|
else // start new game
|
||||||
|
{
|
||||||
|
cursaveslot = 0;
|
||||||
|
M_SetupChoosePlayer(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
278
src/p5prof.h
278
src/p5prof.h
|
@ -1,278 +0,0 @@
|
||||||
/*********************************************************
|
|
||||||
*
|
|
||||||
* File: p5prof.h
|
|
||||||
* By: Kevin Baca
|
|
||||||
*
|
|
||||||
* MODIFIED BY Fab SO THAT RDMSR(...) WRITES EDX : EAX TO A LONG LONG
|
|
||||||
* (WHICH MEANS WRITE THE LOW DWORD FIRST)
|
|
||||||
*
|
|
||||||
* Now in yer code do:
|
|
||||||
* INT64 count,total;
|
|
||||||
*
|
|
||||||
* ...
|
|
||||||
* RDMSR(0x10,&count); //inner loop count
|
|
||||||
* total += count;
|
|
||||||
* ...
|
|
||||||
*
|
|
||||||
* printf("0x%x %x", (INT32)total, *((INT32 *)&total+1));
|
|
||||||
* // HIGH LOW
|
|
||||||
*
|
|
||||||
*********************************************************/
|
|
||||||
/**\file
|
|
||||||
\brief This file provides macros to profile your code.
|
|
||||||
|
|
||||||
Here's how they work...
|
|
||||||
|
|
||||||
As you may or may not know, the Pentium class of
|
|
||||||
processors provides extremely fine grained profiling
|
|
||||||
capabilities through the use of what are called
|
|
||||||
Machine Specific Registers (MSRs). These registers
|
|
||||||
can provide information about almost any aspect of
|
|
||||||
CPU performance down to a single cycle.
|
|
||||||
|
|
||||||
The MSRs of interest for profiling are specified by
|
|
||||||
indices 0x10, 0x11, 0x12, and 0x13. Here is a brief
|
|
||||||
description of each of these registers:
|
|
||||||
|
|
||||||
MSR 0x10
|
|
||||||
This register is simple a cycle counter.
|
|
||||||
|
|
||||||
MSR 0x11
|
|
||||||
This register controls what type of profiling data
|
|
||||||
will be gathered.
|
|
||||||
|
|
||||||
MSRs 0x12 and 0x13
|
|
||||||
These registers gather the profiling data specified in
|
|
||||||
MSR 0x11.
|
|
||||||
|
|
||||||
Each MSR is 64 bits wide. For the Pentium processor,
|
|
||||||
only the lower 32 bits of MSR 0x11 are valid. Bits 0-15
|
|
||||||
specify what data will be gathered in MSR 0x12. Bits 16-31
|
|
||||||
specify what data will be gathered in MSR 0x13. Both sets
|
|
||||||
of bits have the same format:
|
|
||||||
|
|
||||||
Bits 0-5 specify which hardware event will be tracked.
|
|
||||||
Bit 6, if set, indicates events will be tracked in
|
|
||||||
rings 0-2.
|
|
||||||
Bit 7, if set, indicates events will be tracked in
|
|
||||||
ring 3.
|
|
||||||
Bit 8, if set, indicates cycles should be counted for
|
|
||||||
the specified event. If clear, it indicates the
|
|
||||||
number of events should be counted.
|
|
||||||
|
|
||||||
Two instructions are provided for manupulating the MSRs.
|
|
||||||
RDMSR (Read Machine Specific Register) and WRMSR
|
|
||||||
(Write Machine Specific Register). These opcodes were
|
|
||||||
originally undocumented and therefore most assemblers don't
|
|
||||||
recognize them. Their byte codes are provided in the
|
|
||||||
macros below.
|
|
||||||
|
|
||||||
RDMSR takes the MSR index in ecx and the profiling criteria
|
|
||||||
in edx : eax.
|
|
||||||
|
|
||||||
WRMSR takes the MSR index in ecx and returns the profile data
|
|
||||||
in edx : eax.
|
|
||||||
|
|
||||||
Two profiling registers limits profiling capability to
|
|
||||||
gathering only two types of information. The register
|
|
||||||
usage can, however, be combined in interesting ways.
|
|
||||||
For example, you can set one register to gather the
|
|
||||||
number of a specific type of event while the other gathers
|
|
||||||
the number of cycles for the same event. Or you can
|
|
||||||
gather the number of two separate events while using
|
|
||||||
MSR 0x10 to gather the number of cycles.
|
|
||||||
|
|
||||||
The enumerated list provides somewhat readable labels for
|
|
||||||
the types of events that can be tracked.
|
|
||||||
|
|
||||||
For more information, get ahold of appendix H from the
|
|
||||||
Intel Pentium programmer's manual (I don't remember the
|
|
||||||
order number) or go to
|
|
||||||
http://green.kaist.ac.kr/jwhahn/art3.htm.
|
|
||||||
That's an article by Terje Mathisen where I got most of
|
|
||||||
my information.
|
|
||||||
|
|
||||||
You may use this code however you wish. I hope it's
|
|
||||||
useful and I hope I got everything right.
|
|
||||||
|
|
||||||
-Kevin
|
|
||||||
|
|
||||||
kbaca@skygames.com
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
#define RDTSC(_dst) \
|
|
||||||
__asm__("
|
|
||||||
.byte 0x0F,0x31
|
|
||||||
movl %%edx,(%%edi)
|
|
||||||
movl %%eax,4(%%edi)"\
|
|
||||||
: : "D" (_dst) : "eax", "edx", "edi")
|
|
||||||
|
|
||||||
// the old code... swapped it
|
|
||||||
// movl %%edx,(%%edi)
|
|
||||||
// movl %%eax,4(%%edi)"
|
|
||||||
#define RDMSR(_msri, _msrd) \
|
|
||||||
__asm__("
|
|
||||||
.byte 0x0F,0x32
|
|
||||||
movl %%eax,(%%edi)
|
|
||||||
movl %%edx,4(%%edi)"\
|
|
||||||
: : "c" (_msri), "D" (_msrd) : "eax", "ecx", "edx", "edi")
|
|
||||||
|
|
||||||
#define WRMSR(_msri, _msrd) \
|
|
||||||
__asm__("
|
|
||||||
xorl %%edx,%%edx
|
|
||||||
.byte 0x0F,0x30"\
|
|
||||||
: : "c" (_msri), "a" (_msrd) : "eax", "ecx", "edx")
|
|
||||||
|
|
||||||
#define RDMSR_0x12_0x13(_msr12, _msr13) \
|
|
||||||
__asm__("
|
|
||||||
movl $0x12,%%ecx
|
|
||||||
.byte 0x0F,0x32
|
|
||||||
movl %%edx,(%%edi)
|
|
||||||
movl %%eax,4(%%edi)
|
|
||||||
movl $0x13,%%ecx
|
|
||||||
.byte 0x0F,0x32
|
|
||||||
movl %%edx,(%%esi)
|
|
||||||
movl %%eax,4(%%esi)"\
|
|
||||||
: : "D" (_msr12), "S" (_msr13) : "eax", "ecx", "edx", "edi")
|
|
||||||
|
|
||||||
#define ZERO_MSR_0x12_0x13() \
|
|
||||||
__asm__("
|
|
||||||
xorl %%edx,%%edx
|
|
||||||
xorl %%eax,%%eax
|
|
||||||
movl $0x12,%%ecx
|
|
||||||
.byte 0x0F,0x30
|
|
||||||
movl $0x13,%%ecx
|
|
||||||
.byte 0x0F,0x30"\
|
|
||||||
: : : "eax", "ecx", "edx")
|
|
||||||
|
|
||||||
#elif defined (__WATCOMC__)
|
|
||||||
|
|
||||||
extern void RDTSC(UINT32 *dst);
|
|
||||||
#pragma aux RDTSC =\
|
|
||||||
"db 0x0F,0x31"\
|
|
||||||
"mov [edi],edx"\
|
|
||||||
"mov [4+edi],eax"\
|
|
||||||
parm [edi]\
|
|
||||||
modify [eax edx edi];
|
|
||||||
|
|
||||||
extern void RDMSR(UINT32 msri, UINT32 *msrd);
|
|
||||||
#pragma aux RDMSR =\
|
|
||||||
"db 0x0F,0x32"\
|
|
||||||
"mov [edi],edx"\
|
|
||||||
"mov [4+edi],eax"\
|
|
||||||
parm [ecx] [edi]\
|
|
||||||
modify [eax ecx edx edi];
|
|
||||||
|
|
||||||
extern void WRMSR(UINT32 msri, UINT32 msrd);
|
|
||||||
#pragma aux WRMSR =\
|
|
||||||
"xor edx,edx"\
|
|
||||||
"db 0x0F,0x30"\
|
|
||||||
parm [ecx] [eax]\
|
|
||||||
modify [eax ecx edx];
|
|
||||||
|
|
||||||
extern void RDMSR_0x12_0x13(UINT32 *msr12, UINT32 *msr13);
|
|
||||||
#pragma aux RDMSR_0x12_0x13 =\
|
|
||||||
"mov ecx,0x12"\
|
|
||||||
"db 0x0F,0x32"\
|
|
||||||
"mov [edi],edx"\
|
|
||||||
"mov [4+edi],eax"\
|
|
||||||
"mov ecx,0x13"\
|
|
||||||
"db 0x0F,0x32"\
|
|
||||||
"mov [esi],edx"\
|
|
||||||
"mov [4+esi],eax"\
|
|
||||||
parm [edi] [esi]\
|
|
||||||
modify [eax ecx edx edi esi];
|
|
||||||
|
|
||||||
extern void ZERO_MSR_0x12_0x13(void);
|
|
||||||
#pragma aux ZERO_MSR_0x12_0x13 =\
|
|
||||||
"xor edx,edx"\
|
|
||||||
"xor eax,eax"\
|
|
||||||
"mov ecx,0x12"\
|
|
||||||
"db 0x0F,0x30"\
|
|
||||||
"mov ecx,0x13"\
|
|
||||||
"db 0x0F,0x30"\
|
|
||||||
modify [eax ecx edx];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
DataRead,
|
|
||||||
DataWrite,
|
|
||||||
DataTLBMiss,
|
|
||||||
DataReadMiss,
|
|
||||||
DataWriteMiss,
|
|
||||||
WriteHitEM,
|
|
||||||
DataCacheLinesWritten,
|
|
||||||
DataCacheSnoops,
|
|
||||||
DataCacheSnoopHit,
|
|
||||||
MemAccessBothPipes,
|
|
||||||
BankConflict,
|
|
||||||
MisalignedDataRef,
|
|
||||||
CodeRead,
|
|
||||||
CodeTLBMiss,
|
|
||||||
CodeCacheMiss,
|
|
||||||
SegRegLoad,
|
|
||||||
RESERVED0,
|
|
||||||
RESERVED1,
|
|
||||||
Branch,
|
|
||||||
BTBHit,
|
|
||||||
TakenBranchOrBTBHit,
|
|
||||||
PipelineFlush,
|
|
||||||
InstructionsExeced,
|
|
||||||
InstructionsExecedVPipe,
|
|
||||||
BusUtilizationClocks,
|
|
||||||
PipelineStalledWriteBackup,
|
|
||||||
PipelineStalledDateMemRead,
|
|
||||||
PipeLineStalledWriteEM,
|
|
||||||
LockedBusCycle,
|
|
||||||
IOReadOrWriteCycle,
|
|
||||||
NonCacheableMemRef,
|
|
||||||
AGI,
|
|
||||||
RESERVED2,
|
|
||||||
RESERVED3,
|
|
||||||
FPOperation,
|
|
||||||
Breakpoint0Match,
|
|
||||||
Breakpoint1Match,
|
|
||||||
Breakpoint2Match,
|
|
||||||
Breakpoint3Match,
|
|
||||||
HWInterrupt,
|
|
||||||
DataReadOrWrite,
|
|
||||||
DataReadOrWriteMiss
|
|
||||||
};
|
|
||||||
|
|
||||||
#define PROF_CYCLES (0x100)
|
|
||||||
#define PROF_EVENTS (0x000)
|
|
||||||
#define RING_012 (0x40)
|
|
||||||
#define RING_3 (0x80)
|
|
||||||
#define RING_0123 (RING_012 | RING_3)
|
|
||||||
|
|
||||||
/*void ProfSetProfiles(UINT32 msr12, UINT32 msr13);*/
|
|
||||||
#define ProfSetProfiles(_msr12, _msr13)\
|
|
||||||
{\
|
|
||||||
UINT32 prof;\
|
|
||||||
\
|
|
||||||
prof = (_msr12) | ((_msr13) << 16);\
|
|
||||||
WRMSR(0x11, prof);\
|
|
||||||
}
|
|
||||||
|
|
||||||
/*void ProfBeginProfiles(void);*/
|
|
||||||
#define ProfBeginProfiles()\
|
|
||||||
ZERO_MSR_0x12_0x13();
|
|
||||||
|
|
||||||
/*void ProfGetProfiles(UINT32 msr12[2], UINT32 msr13[2]);*/
|
|
||||||
#define ProfGetProfiles(_msr12, _msr13)\
|
|
||||||
RDMSR_0x12_0x13(_msr12, _msr13);
|
|
||||||
|
|
||||||
/*void ProfZeroTimer(void);*/
|
|
||||||
#define ProfZeroTimer()\
|
|
||||||
WRMSR(0x10, 0);
|
|
||||||
|
|
||||||
/*void ProfReadTimer(UINT32 timer[2]);*/
|
|
||||||
#define ProfReadTimer(timer)\
|
|
||||||
RDMSR(0x10, timer);
|
|
||||||
|
|
||||||
/*EOF*/
|
|
|
@ -829,7 +829,7 @@ static boolean P_LookForShield(mobj_t *actor)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((player->powers[pw_shield] & SH_PROTECTELECTRIC)
|
if ((player->powers[pw_shield] & SH_PROTECTELECTRIC)
|
||||||
&& (P_AproxDistance(P_AproxDistance(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale)))
|
&& (R_PointToDist2(0, 0, R_PointToDist2(0, 0, actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale)))
|
||||||
{
|
{
|
||||||
P_SetTarget(&actor->tracer, player->mo);
|
P_SetTarget(&actor->tracer, player->mo);
|
||||||
|
|
||||||
|
|
|
@ -2235,7 +2235,7 @@ void P_CheckTimeLimit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Optional tie-breaker for Match/CTF
|
//Optional tie-breaker for Match/CTF
|
||||||
|
@ -2298,11 +2298,11 @@ void P_CheckTimeLimit(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Checks if a player's score is over the pointlimit and the round should end.
|
/** Checks if a player's score is over the pointlimit and the round should end.
|
||||||
|
@ -2331,7 +2331,7 @@ void P_CheckPointLimit(void)
|
||||||
if ((UINT32)cv_pointlimit.value <= redscore || (UINT32)cv_pointlimit.value <= bluescore)
|
if ((UINT32)cv_pointlimit.value <= redscore || (UINT32)cv_pointlimit.value <= bluescore)
|
||||||
{
|
{
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2344,7 +2344,7 @@ void P_CheckPointLimit(void)
|
||||||
if ((UINT32)cv_pointlimit.value <= players[i].score)
|
if ((UINT32)cv_pointlimit.value <= players[i].score)
|
||||||
{
|
{
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2388,7 +2388,7 @@ void P_CheckSurvivors(void)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("The IT player has left the game.\n"));
|
CONS_Printf(M_GetText("The IT player has left the game.\n"));
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2408,7 +2408,7 @@ void P_CheckSurvivors(void)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("All players have been tagged!\n"));
|
CONS_Printf(M_GetText("All players have been tagged!\n"));
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -2420,7 +2420,7 @@ void P_CheckSurvivors(void)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("There are no players able to become IT.\n"));
|
CONS_Printf(M_GetText("There are no players able to become IT.\n"));
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -2432,7 +2432,7 @@ void P_CheckSurvivors(void)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("All players have been tagged!\n"));
|
CONS_Printf(M_GetText("All players have been tagged!\n"));
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
src/p_mobj.c
22
src/p_mobj.c
|
@ -9228,7 +9228,7 @@ static void P_DragonbomberThink(mobj_t *mobj)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fixed_t vspeed = FixedMul(mobj->info->speed >> 3, mobj->scale);
|
fixed_t vspeed = FixedMul(mobj->info->speed >> 3, mobj->scale);
|
||||||
fixed_t z = mobj->target->z + (mobj->height >> 1) + (mobj->flags & MFE_VERTICALFLIP ? -128*mobj->scale : 128*mobj->scale + mobj->target->height);
|
fixed_t z = mobj->target->z + (mobj->height >> 1) + (mobj->eflags & MFE_VERTICALFLIP ? -128*mobj->scale : (128*mobj->scale + mobj->target->height));
|
||||||
angle_t diff = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y) - mobj->angle;
|
angle_t diff = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y) - mobj->angle;
|
||||||
if (diff > ANGLE_180)
|
if (diff > ANGLE_180)
|
||||||
mobj->angle -= DRAGONTURNSPEED;
|
mobj->angle -= DRAGONTURNSPEED;
|
||||||
|
@ -11181,12 +11181,6 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||||
|
|
||||||
P_SetTarget(&mobj->hnext, P_SetTarget(&mobj->hprev, NULL));
|
P_SetTarget(&mobj->hnext, P_SetTarget(&mobj->hprev, NULL));
|
||||||
|
|
||||||
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
|
|
||||||
#ifdef SCRAMBLE_REMOVED
|
|
||||||
// Invalidate mobj_t data to cause crashes if accessed!
|
|
||||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
R_RemoveMobjInterpolator(mobj);
|
R_RemoveMobjInterpolator(mobj);
|
||||||
|
|
||||||
// free block
|
// free block
|
||||||
|
@ -11205,6 +11199,17 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||||
}
|
}
|
||||||
|
|
||||||
P_RemoveThinker((thinker_t *)mobj);
|
P_RemoveThinker((thinker_t *)mobj);
|
||||||
|
|
||||||
|
#ifdef PARANOIA
|
||||||
|
// Saved to avoid being scrambled like below...
|
||||||
|
mobj->thinker.debug_mobjtype = mobj->type;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
|
||||||
|
#ifdef SCRAMBLE_REMOVED
|
||||||
|
// Invalidate mobj_t data to cause crashes if accessed!
|
||||||
|
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// This does not need to be added to Lua.
|
// This does not need to be added to Lua.
|
||||||
|
@ -13327,6 +13332,9 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y,
|
||||||
P_SetScale(mobj, FixedMul(mobj->scale, mthing->scale));
|
P_SetScale(mobj, FixedMul(mobj->scale, mthing->scale));
|
||||||
mobj->destscale = FixedMul(mobj->destscale, mthing->scale);
|
mobj->destscale = FixedMul(mobj->destscale, mthing->scale);
|
||||||
|
|
||||||
|
mobj->spritexscale = mthing->spritexscale;
|
||||||
|
mobj->spriteyscale = mthing->spriteyscale;
|
||||||
|
|
||||||
if (!P_SetupSpawnedMapThing(mthing, mobj, &doangle))
|
if (!P_SetupSpawnedMapThing(mthing, mobj, &doangle))
|
||||||
return mobj;
|
return mobj;
|
||||||
|
|
||||||
|
|
|
@ -2716,8 +2716,8 @@ static void P_NetArchiveThinkers(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
else if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) // wait garbage collection
|
else
|
||||||
I_Error("unknown thinker type %p", th->function.acp1);
|
I_Assert(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed); // wait garbage collection
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1464,6 +1464,7 @@ static void P_LoadThings(UINT8 *data)
|
||||||
mt->extrainfo = (UINT8)(mt->type >> 12);
|
mt->extrainfo = (UINT8)(mt->type >> 12);
|
||||||
Tag_FSet(&mt->tags, 0);
|
Tag_FSet(&mt->tags, 0);
|
||||||
mt->scale = FRACUNIT;
|
mt->scale = FRACUNIT;
|
||||||
|
mt->spritexscale = mt->spriteyscale = FRACUNIT;
|
||||||
memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args));
|
memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args));
|
||||||
memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs));
|
memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs));
|
||||||
mt->pitch = mt->roll = 0;
|
mt->pitch = mt->roll = 0;
|
||||||
|
@ -1967,7 +1968,13 @@ static void ParseTextmapThingParameter(UINT32 i, const char *param, const char *
|
||||||
mapthings[i].roll = atol(val);
|
mapthings[i].roll = atol(val);
|
||||||
else if (fastcmp(param, "type"))
|
else if (fastcmp(param, "type"))
|
||||||
mapthings[i].type = atol(val);
|
mapthings[i].type = atol(val);
|
||||||
else if (fastcmp(param, "scale") || fastcmp(param, "scalex") || fastcmp(param, "scaley"))
|
else if (fastcmp(param, "scale"))
|
||||||
|
mapthings[i].spritexscale = mapthings[i].spriteyscale = FLOAT_TO_FIXED(atof(val));
|
||||||
|
else if (fastcmp(param, "scalex"))
|
||||||
|
mapthings[i].spritexscale = FLOAT_TO_FIXED(atof(val));
|
||||||
|
else if (fastcmp(param, "scaley"))
|
||||||
|
mapthings[i].spriteyscale = FLOAT_TO_FIXED(atof(val));
|
||||||
|
else if (fastcmp(param, "mobjscale"))
|
||||||
mapthings[i].scale = FLOAT_TO_FIXED(atof(val));
|
mapthings[i].scale = FLOAT_TO_FIXED(atof(val));
|
||||||
// Flags
|
// Flags
|
||||||
else if (fastcmp(param, "flip") && fastcmp("true", val))
|
else if (fastcmp(param, "flip") && fastcmp("true", val))
|
||||||
|
@ -2385,8 +2392,12 @@ static void P_WriteTextmap(void)
|
||||||
fprintf(f, "roll = %d;\n", wmapthings[i].roll);
|
fprintf(f, "roll = %d;\n", wmapthings[i].roll);
|
||||||
if (wmapthings[i].type != 0)
|
if (wmapthings[i].type != 0)
|
||||||
fprintf(f, "type = %d;\n", wmapthings[i].type);
|
fprintf(f, "type = %d;\n", wmapthings[i].type);
|
||||||
|
if (wmapthings[i].spritexscale != FRACUNIT)
|
||||||
|
fprintf(f, "scalex = %f;\n", FIXED_TO_FLOAT(wmapthings[i].spritexscale));
|
||||||
|
if (wmapthings[i].spriteyscale != FRACUNIT)
|
||||||
|
fprintf(f, "scaley = %f;\n", FIXED_TO_FLOAT(wmapthings[i].spriteyscale));
|
||||||
if (wmapthings[i].scale != FRACUNIT)
|
if (wmapthings[i].scale != FRACUNIT)
|
||||||
fprintf(f, "scale = %f;\n", FIXED_TO_FLOAT(wmapthings[i].scale));
|
fprintf(f, "mobjscale = %f;\n", FIXED_TO_FLOAT(wmapthings[i].scale));
|
||||||
if (wmapthings[i].options & MTF_OBJECTFLIP)
|
if (wmapthings[i].options & MTF_OBJECTFLIP)
|
||||||
fprintf(f, "flip = true;\n");
|
fprintf(f, "flip = true;\n");
|
||||||
for (j = 0; j < NUMMAPTHINGARGS; j++)
|
for (j = 0; j < NUMMAPTHINGARGS; j++)
|
||||||
|
@ -2932,6 +2943,7 @@ static void P_LoadTextmap(void)
|
||||||
mt->extrainfo = 0;
|
mt->extrainfo = 0;
|
||||||
Tag_FSet(&mt->tags, 0);
|
Tag_FSet(&mt->tags, 0);
|
||||||
mt->scale = FRACUNIT;
|
mt->scale = FRACUNIT;
|
||||||
|
mt->spritexscale = mt->spriteyscale = FRACUNIT;
|
||||||
memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args));
|
memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args));
|
||||||
memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs));
|
memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs));
|
||||||
mt->mobj = NULL;
|
mt->mobj = NULL;
|
||||||
|
@ -5406,7 +5418,7 @@ static void P_ConvertBinaryLinedefTypes(void)
|
||||||
break;
|
break;
|
||||||
case 442: //Change object type state
|
case 442: //Change object type state
|
||||||
lines[i].args[0] = tag;
|
lines[i].args[0] = tag;
|
||||||
lines[i].args[3] = (lines[i].sidenum[1] == 0xffff) ? 1 : 0;
|
lines[i].args[1] = (lines[i].sidenum[1] == 0xffff) ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
case 443: //Call Lua function
|
case 443: //Call Lua function
|
||||||
if (lines[i].stringargs[0] == NULL)
|
if (lines[i].stringargs[0] == NULL)
|
||||||
|
@ -7746,18 +7758,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||||
R_InitMobjInterpolators();
|
R_InitMobjInterpolators();
|
||||||
P_InitCachedActions();
|
P_InitCachedActions();
|
||||||
|
|
||||||
if (!fromnetsave && savedata.lives > 0)
|
|
||||||
{
|
|
||||||
numgameovers = savedata.numgameovers;
|
|
||||||
players[consoleplayer].continues = savedata.continues;
|
|
||||||
players[consoleplayer].lives = savedata.lives;
|
|
||||||
players[consoleplayer].score = savedata.score;
|
|
||||||
if ((botingame = ((botskin = savedata.botskin) != 0)))
|
|
||||||
botcolor = skins[botskin-1].prefcolor;
|
|
||||||
emeralds = savedata.emeralds;
|
|
||||||
savedata.lives = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// internal game map
|
// internal game map
|
||||||
maplumpname = G_BuildMapName(gamemap);
|
maplumpname = G_BuildMapName(gamemap);
|
||||||
lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);
|
lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);
|
||||||
|
@ -8189,7 +8189,7 @@ static boolean P_LoadAddon(UINT16 numlumps)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Current map %d replaced by added file, ending the level to ensure consistency.\n"), gamemap);
|
CONS_Printf(M_GetText("Current map %d replaced by added file, ending the level to ensure consistency.\n"), gamemap);
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
12
src/p_spec.c
12
src/p_spec.c
|
@ -2491,11 +2491,13 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
// Change the music and apply position/fade operations
|
// Change the music and apply position/fade operations
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!line->stringargs[0])
|
if (!line->stringargs[0] || !strcmp(line->stringargs[0], "-"))
|
||||||
break;
|
strcpy(mapmusname, "");
|
||||||
|
else
|
||||||
strncpy(mapmusname, line->stringargs[0], 7);
|
{
|
||||||
mapmusname[6] = 0;
|
strncpy(mapmusname, line->stringargs[0], 7);
|
||||||
|
mapmusname[6] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
mapmusflags = tracknum & MUSIC_TRACKMASK;
|
mapmusflags = tracknum & MUSIC_TRACKMASK;
|
||||||
if (!(line->args[0] & TMM_NORELOAD))
|
if (!(line->args[0] & TMM_NORELOAD))
|
||||||
|
|
120
src/p_tick.c
120
src/p_tick.c
|
@ -30,6 +30,10 @@
|
||||||
// Object place
|
// Object place
|
||||||
#include "m_cheat.h"
|
#include "m_cheat.h"
|
||||||
|
|
||||||
|
#ifdef PARANOIA
|
||||||
|
#include "deh_tables.h" // MOBJTYPE_LIST
|
||||||
|
#endif
|
||||||
|
|
||||||
tic_t leveltime;
|
tic_t leveltime;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -211,8 +215,49 @@ void P_AddThinker(const thinklistnum_t n, thinker_t *thinker)
|
||||||
thlist[n].prev = thinker;
|
thlist[n].prev = thinker;
|
||||||
|
|
||||||
thinker->references = 0; // killough 11/98: init reference counter to 0
|
thinker->references = 0; // killough 11/98: init reference counter to 0
|
||||||
|
|
||||||
|
#ifdef PARANOIA
|
||||||
|
thinker->debug_mobjtype = MT_NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PARANOIA
|
||||||
|
static const char *MobjTypeName(const mobj_t *mobj)
|
||||||
|
{
|
||||||
|
actionf_p1 p1 = mobj->thinker.function.acp1;
|
||||||
|
|
||||||
|
if (p1 == (actionf_p1)P_MobjThinker)
|
||||||
|
{
|
||||||
|
return MOBJTYPE_LIST[mobj->type];
|
||||||
|
}
|
||||||
|
else if (p1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||||
|
{
|
||||||
|
if (mobj->thinker.debug_mobjtype != MT_NULL)
|
||||||
|
{
|
||||||
|
return MOBJTYPE_LIST[mobj->thinker.debug_mobjtype];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<Not a mobj>";
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *MobjThinkerName(const mobj_t *mobj)
|
||||||
|
{
|
||||||
|
actionf_p1 p1 = mobj->thinker.function.acp1;
|
||||||
|
|
||||||
|
if (p1 == (actionf_p1)P_MobjThinker)
|
||||||
|
{
|
||||||
|
return "P_MobjThinker";
|
||||||
|
}
|
||||||
|
else if (p1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||||
|
{
|
||||||
|
return "P_RemoveThinkerDelayed";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<Unknown Thinker>";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// killough 11/98:
|
// killough 11/98:
|
||||||
//
|
//
|
||||||
|
@ -234,20 +279,34 @@ static thinker_t *currentthinker;
|
||||||
void P_RemoveThinkerDelayed(thinker_t *thinker)
|
void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||||
{
|
{
|
||||||
thinker_t *next;
|
thinker_t *next;
|
||||||
#ifdef PARANOIA
|
|
||||||
#define BEENAROUNDBIT (0x40000000) // has to be sufficiently high that it's unlikely to happen in regular gameplay. If you change this, pay attention to the bit pattern of INT32_MIN.
|
if (thinker->references != 0)
|
||||||
if (thinker->references & ~BEENAROUNDBIT)
|
|
||||||
{
|
{
|
||||||
if (thinker->references & BEENAROUNDBIT) // Usually gets cleared up in one frame; what's going on here, then?
|
#ifdef PARANOIA
|
||||||
CONS_Printf("Number of potentially faulty references: %d\n", (thinker->references & ~BEENAROUNDBIT));
|
if (thinker->debug_time > leveltime)
|
||||||
thinker->references |= BEENAROUNDBIT;
|
{
|
||||||
|
thinker->debug_time = leveltime + 2; // do not print errors again
|
||||||
|
}
|
||||||
|
// Removed mobjs can be the target of another mobj. In
|
||||||
|
// that case, the other mobj will manage its reference
|
||||||
|
// to the removed mobj in P_MobjThinker. However, if
|
||||||
|
// the removed mobj is removed after the other object
|
||||||
|
// thinks, the reference management is delayed by one
|
||||||
|
// tic.
|
||||||
|
else if (thinker->debug_time < leveltime)
|
||||||
|
{
|
||||||
|
CONS_Printf(
|
||||||
|
"PARANOIA/P_RemoveThinkerDelayed: %p %s references=%d\n",
|
||||||
|
(void*)thinker,
|
||||||
|
MobjTypeName((mobj_t*)thinker),
|
||||||
|
thinker->references
|
||||||
|
);
|
||||||
|
|
||||||
|
thinker->debug_time = leveltime + 2; // do not print this error again
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#undef BEENAROUNDBIT
|
|
||||||
#else
|
|
||||||
if (thinker->references)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Remove from main thinker list */
|
/* Remove from main thinker list */
|
||||||
next = thinker->next;
|
next = thinker->next;
|
||||||
|
@ -291,12 +350,45 @@ void P_RemoveThinker(thinker_t *thinker)
|
||||||
* references, and delay removal until the count is 0.
|
* references, and delay removal until the count is 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mobj_t *P_SetTarget(mobj_t **mop, mobj_t *targ)
|
mobj_t *P_SetTarget2(mobj_t **mop, mobj_t *targ
|
||||||
|
#ifdef PARANOIA
|
||||||
|
, const char *source_file, int source_line
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (*mop) // If there was a target already, decrease its refcount
|
if (*mop) // If there was a target already, decrease its refcount
|
||||||
|
{
|
||||||
(*mop)->thinker.references--;
|
(*mop)->thinker.references--;
|
||||||
if ((*mop = targ) != NULL) // Set new target and if non-NULL, increase its counter
|
|
||||||
|
#ifdef PARANOIA
|
||||||
|
if ((*mop)->thinker.references < 0)
|
||||||
|
{
|
||||||
|
CONS_Printf(
|
||||||
|
"PARANOIA/P_SetTarget: %p %s %s references=%d, references go negative! (%s:%d)\n",
|
||||||
|
(void*)*mop,
|
||||||
|
MobjTypeName(*mop),
|
||||||
|
MobjThinkerName(*mop),
|
||||||
|
(*mop)->thinker.references,
|
||||||
|
source_file,
|
||||||
|
source_line
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
(*mop)->thinker.debug_time = leveltime;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targ != NULL) // Set new target and if non-NULL, increase its counter
|
||||||
|
{
|
||||||
targ->thinker.references++;
|
targ->thinker.references++;
|
||||||
|
|
||||||
|
#ifdef PARANOIA
|
||||||
|
targ->thinker.debug_time = leveltime;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
*mop = targ;
|
||||||
|
|
||||||
return targ;
|
return targ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
src/p_tick.h
15
src/p_tick.h
|
@ -14,6 +14,8 @@
|
||||||
#ifndef __P_TICK__
|
#ifndef __P_TICK__
|
||||||
#define __P_TICK__
|
#define __P_TICK__
|
||||||
|
|
||||||
|
#include "doomdef.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,6 +30,17 @@ void P_Ticker(boolean run);
|
||||||
void P_PreTicker(INT32 frames);
|
void P_PreTicker(INT32 frames);
|
||||||
void P_DoTeamscrambling(void);
|
void P_DoTeamscrambling(void);
|
||||||
void P_RemoveThinkerDelayed(thinker_t *thinker); //killed
|
void P_RemoveThinkerDelayed(thinker_t *thinker); //killed
|
||||||
mobj_t *P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98
|
|
||||||
|
mobj_t *P_SetTarget2(mobj_t **mo, mobj_t *target
|
||||||
|
#ifdef PARANOIA
|
||||||
|
, const char *source_file, int source_line
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef PARANOIA
|
||||||
|
#define P_SetTarget(...) P_SetTarget2(__VA_ARGS__, __FILE__, __LINE__)
|
||||||
|
#else
|
||||||
|
#define P_SetTarget P_SetTarget2
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
12
src/p_user.c
12
src/p_user.c
|
@ -2005,7 +2005,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||||
ghost->standingslope = mobj->standingslope;
|
ghost->standingslope = mobj->standingslope;
|
||||||
|
|
||||||
if (mobj->flags2 & MF2_OBJECTFLIP)
|
if (mobj->flags2 & MF2_OBJECTFLIP)
|
||||||
ghost->flags |= MF2_OBJECTFLIP;
|
ghost->flags2 |= MF2_OBJECTFLIP;
|
||||||
|
|
||||||
if (mobj->player && mobj->player->followmobj)
|
if (mobj->player && mobj->player->followmobj)
|
||||||
{
|
{
|
||||||
|
@ -9287,7 +9287,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet)
|
||||||
|
|
||||||
{
|
{
|
||||||
fixed_t zdist = (player->mo->z + player->mo->height/2) - (mo->z + mo->height/2);
|
fixed_t zdist = (player->mo->z + player->mo->height/2) - (mo->z + mo->height/2);
|
||||||
dist = P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y);
|
dist = R_PointToDist2(0, 0, player->mo->x-mo->x, player->mo->y-mo->y);
|
||||||
if (bullet)
|
if (bullet)
|
||||||
{
|
{
|
||||||
if ((R_PointToAngle2(0, 0, dist, zdist) + span) > span*2)
|
if ((R_PointToAngle2(0, 0, dist, zdist) + span) > span*2)
|
||||||
|
@ -9304,7 +9304,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dist = P_AproxDistance(dist, zdist);
|
dist = R_PointToDist2(0, 0, dist, zdist);
|
||||||
if (dist > maxdist)
|
if (dist > maxdist)
|
||||||
continue; // out of range
|
continue; // out of range
|
||||||
}
|
}
|
||||||
|
@ -11507,7 +11507,7 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
|
||||||
}
|
}
|
||||||
|
|
||||||
fume->movecount = dashmode; // keeps track of previous dashmode value so we know whether Metal is entering or leaving it
|
fume->movecount = dashmode; // keeps track of previous dashmode value so we know whether Metal is entering or leaving it
|
||||||
fume->eflags = (fume->flags2 & ~MF2_OBJECTFLIP) | (mo->flags2 & MF2_OBJECTFLIP); // Make sure to flip in reverse gravity!
|
fume->flags2 = (fume->flags2 & ~MF2_OBJECTFLIP) | (mo->flags2 & MF2_OBJECTFLIP); // Make sure to flip in reverse gravity!
|
||||||
fume->eflags = (fume->eflags & ~MFE_VERTICALFLIP) | (mo->eflags & MFE_VERTICALFLIP); // Make sure to flip in reverse gravity!
|
fume->eflags = (fume->eflags & ~MFE_VERTICALFLIP) | (mo->eflags & MFE_VERTICALFLIP); // Make sure to flip in reverse gravity!
|
||||||
|
|
||||||
// Finally, set its position
|
// Finally, set its position
|
||||||
|
@ -11758,7 +11758,7 @@ void P_PlayerThink(player_t *player)
|
||||||
if (!total || ((4*exiting)/total) >= numneeded)
|
if (!total || ((4*exiting)/total) >= numneeded)
|
||||||
{
|
{
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player->exiting = 3;
|
player->exiting = 3;
|
||||||
|
@ -11766,7 +11766,7 @@ void P_PlayerThink(player_t *player)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (server)
|
if (server)
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
D_SendExitLevel(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,8 +179,6 @@ CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
|
||||||
void R_InitTranslucencyTables(void)
|
void R_InitTranslucencyTables(void)
|
||||||
{
|
{
|
||||||
// Load here the transparency lookup tables 'TRANSx0'
|
// Load here the transparency lookup tables 'TRANSx0'
|
||||||
// NOTE: the TRANSx0 resources MUST BE aligned on 64k for the asm
|
|
||||||
// optimised code (in other words, transtables pointer low word is 0)
|
|
||||||
transtables = Z_MallocAlign(NUMTRANSTABLES*0x10000, PU_STATIC,
|
transtables = Z_MallocAlign(NUMTRANSTABLES*0x10000, PU_STATIC,
|
||||||
NULL, 16);
|
NULL, 16);
|
||||||
|
|
||||||
|
|
12
src/r_draw.h
12
src/r_draw.h
|
@ -225,18 +225,6 @@ void R_DrawTiltedTransSolidColorSpan_8(void);
|
||||||
void R_DrawWaterSolidColorSpan_8(void);
|
void R_DrawWaterSolidColorSpan_8(void);
|
||||||
void R_DrawTiltedWaterSolidColorSpan_8(void);
|
void R_DrawTiltedWaterSolidColorSpan_8(void);
|
||||||
|
|
||||||
#ifdef USEASM
|
|
||||||
void ASMCALL R_DrawColumn_8_ASM(void);
|
|
||||||
void ASMCALL R_DrawShadeColumn_8_ASM(void);
|
|
||||||
void ASMCALL R_DrawTranslucentColumn_8_ASM(void);
|
|
||||||
void ASMCALL R_Draw2sMultiPatchColumn_8_ASM(void);
|
|
||||||
|
|
||||||
void ASMCALL R_DrawColumn_8_MMX(void);
|
|
||||||
|
|
||||||
void ASMCALL R_Draw2sMultiPatchColumn_8_MMX(void);
|
|
||||||
void ASMCALL R_DrawSpan_8_MMX(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ------------------
|
// ------------------
|
||||||
// 16bpp DRAWING CODE
|
// 16bpp DRAWING CODE
|
||||||
// ------------------
|
// ------------------
|
||||||
|
|
|
@ -31,20 +31,8 @@ static void prepare_rastertab(void);
|
||||||
|
|
||||||
static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis);
|
static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis);
|
||||||
|
|
||||||
#ifdef USEASM
|
|
||||||
void ASMCALL rasterize_segment_tex_asm(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 tv1, INT32 tv2, INT32 tc, INT32 dir);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 tv1, INT32 tv2, INT32 tc, INT32 dir)
|
static void rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 tv1, INT32 tv2, INT32 tc, INT32 dir)
|
||||||
{
|
{
|
||||||
#ifdef USEASM
|
|
||||||
if (R_ASM)
|
|
||||||
{
|
|
||||||
rasterize_segment_tex_asm(x1, y1, x2, y2, tv1, tv2, tc, dir);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
fixed_t xs, xe, count;
|
fixed_t xs, xe, count;
|
||||||
fixed_t dx0, dx1;
|
fixed_t dx0, dx1;
|
||||||
|
|
27
src/screen.c
27
src/screen.c
|
@ -44,10 +44,6 @@
|
||||||
// SRB2Kart
|
// SRB2Kart
|
||||||
#include "r_fps.h" // R_GetFramerateCap
|
#include "r_fps.h" // R_GetFramerateCap
|
||||||
|
|
||||||
#if defined (USEASM) && !defined (NORUSEASM)//&& (!defined (_MSC_VER) || (_MSC_VER <= 1200))
|
|
||||||
#define RUSEASM //MSC.NET can't patch itself
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
// assembly or c drawer routines for 8bpp/16bpp
|
// assembly or c drawer routines for 8bpp/16bpp
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
|
@ -102,7 +98,6 @@ UINT8 *scr_borderpatch; // flat used to fill the reduced view borders set at ST_
|
||||||
// Short and Tall sky drawer, for the current color mode
|
// Short and Tall sky drawer, for the current color mode
|
||||||
void (*walldrawerfunc)(void);
|
void (*walldrawerfunc)(void);
|
||||||
|
|
||||||
boolean R_ASM = true;
|
|
||||||
boolean R_486 = false;
|
boolean R_486 = false;
|
||||||
boolean R_586 = false;
|
boolean R_586 = false;
|
||||||
boolean R_MMX = false;
|
boolean R_MMX = false;
|
||||||
|
@ -169,26 +164,6 @@ void SCR_SetDrawFuncs(void)
|
||||||
spanfuncs_npo2[SPANDRAWFUNC_WATER] = R_DrawWaterSpan_NPO2_8;
|
spanfuncs_npo2[SPANDRAWFUNC_WATER] = R_DrawWaterSpan_NPO2_8;
|
||||||
spanfuncs_npo2[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedWaterSpan_NPO2_8;
|
spanfuncs_npo2[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedWaterSpan_NPO2_8;
|
||||||
|
|
||||||
#ifdef RUSEASM
|
|
||||||
if (R_ASM)
|
|
||||||
{
|
|
||||||
if (R_MMX)
|
|
||||||
{
|
|
||||||
colfuncs[BASEDRAWFUNC] = R_DrawColumn_8_MMX;
|
|
||||||
//colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8_ASM;
|
|
||||||
//colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_8_ASM;
|
|
||||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8_MMX;
|
|
||||||
spanfuncs[BASEDRAWFUNC] = R_DrawSpan_8_MMX;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
colfuncs[BASEDRAWFUNC] = R_DrawColumn_8_ASM;
|
|
||||||
//colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8_ASM;
|
|
||||||
//colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_8_ASM;
|
|
||||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8_ASM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/* else if (vid.bpp > 1)
|
/* else if (vid.bpp > 1)
|
||||||
{
|
{
|
||||||
|
@ -271,8 +246,6 @@ void SCR_Startup(void)
|
||||||
CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n", R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2);
|
CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n", R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (M_CheckParm("-noASM"))
|
|
||||||
R_ASM = false;
|
|
||||||
if (M_CheckParm("-486"))
|
if (M_CheckParm("-486"))
|
||||||
R_486 = true;
|
R_486 = true;
|
||||||
if (M_CheckParm("-586"))
|
if (M_CheckParm("-586"))
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
# Declare SDL2 interface sources
|
# Declare SDL2 interface sources
|
||||||
|
|
||||||
target_sources(SRB2SDL2 PRIVATE mixer_sound.c)
|
target_sources(SRB2SDL2 PRIVATE
|
||||||
|
mixer_sound.c
|
||||||
target_sourcefile(c)
|
ogl_sdl.c
|
||||||
|
i_threads.c
|
||||||
target_sources(SRB2SDL2 PRIVATE ogl_sdl.c)
|
i_net.c
|
||||||
|
i_system.c
|
||||||
target_sources(SRB2SDL2 PRIVATE i_threads.c)
|
i_main.c
|
||||||
|
i_video.c
|
||||||
if(${SRB2_USEASM})
|
dosstr.c
|
||||||
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES LANGUAGE C)
|
endtxt.c
|
||||||
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
|
hwsym_sdl.c
|
||||||
endif()
|
)
|
||||||
|
|
||||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
||||||
target_sources(SRB2SDL2 PRIVATE
|
target_sources(SRB2SDL2 PRIVATE
|
||||||
|
@ -68,18 +68,6 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES Linux)
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE m rt)
|
target_link_libraries(SRB2SDL2 PRIVATE m rt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${SRB2_USEASM})
|
|
||||||
if(${SRB2_CONFIG_YASM})
|
|
||||||
set(ASM_ASSEMBLER_TEMP ${CMAKE_ASM_YASM_COMPILER})
|
|
||||||
set(ASM_ASSEMBLER_OBJFORMAT ${CMAKE_ASM_YASM_OBJECT_FORMAT})
|
|
||||||
set_source_files_properties(${SRB2_NASM_SOURCES} LANGUAGE ASM_YASM)
|
|
||||||
else()
|
|
||||||
set(ASM_ASSEMBLER_TEMP ${CMAKE_ASM_NASM_COMPILER})
|
|
||||||
set(ASM_ASSEMBLER_OBJFORMAT ${CMAKE_ASM_NASM_OBJECT_FORMAT})
|
|
||||||
set_source_files_properties(${SRB2_NASM_SOURCES} LANGUAGE ASM_NASM)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
target_link_libraries(SRB2SDL2 PRIVATE
|
||||||
ws2_32
|
ws2_32
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
NOHW=1
|
NOHW=1
|
||||||
NOHS=1
|
NOHS=1
|
||||||
NOASM=1
|
|
||||||
|
|
||||||
OPTS+=-DLINUX
|
OPTS+=-DLINUX
|
||||||
|
|
||||||
|
|
|
@ -70,39 +70,6 @@ char logfilename[1024];
|
||||||
typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
|
typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (_WIN32)
|
|
||||||
static inline VOID MakeCodeWritable(VOID)
|
|
||||||
{
|
|
||||||
#ifdef USEASM // Disable write-protection of code segment
|
|
||||||
DWORD OldRights;
|
|
||||||
const DWORD NewRights = PAGE_EXECUTE_READWRITE;
|
|
||||||
PBYTE pBaseOfImage = (PBYTE)GetModuleHandle(NULL);
|
|
||||||
PIMAGE_DOS_HEADER dosH =(PIMAGE_DOS_HEADER)pBaseOfImage;
|
|
||||||
PIMAGE_NT_HEADERS ntH = (PIMAGE_NT_HEADERS)(pBaseOfImage + dosH->e_lfanew);
|
|
||||||
PIMAGE_OPTIONAL_HEADER oH = (PIMAGE_OPTIONAL_HEADER)
|
|
||||||
((PBYTE)ntH + sizeof (IMAGE_NT_SIGNATURE) + sizeof (IMAGE_FILE_HEADER));
|
|
||||||
LPVOID pA = pBaseOfImage+oH->BaseOfCode;
|
|
||||||
SIZE_T pS = oH->SizeOfCode;
|
|
||||||
#if 1 // try to find the text section
|
|
||||||
PIMAGE_SECTION_HEADER ntS = IMAGE_FIRST_SECTION (ntH);
|
|
||||||
WORD s;
|
|
||||||
for (s = 0; s < ntH->FileHeader.NumberOfSections; s++)
|
|
||||||
{
|
|
||||||
if (memcmp (ntS[s].Name, ".text\0\0", 8) == 0)
|
|
||||||
{
|
|
||||||
pA = pBaseOfImage+ntS[s].VirtualAddress;
|
|
||||||
pS = ntS[s].Misc.VirtualSize;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!VirtualProtect(pA,pS,NewRights,&OldRights))
|
|
||||||
I_Error("Could not make code writable\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LOGMESSAGES
|
#ifdef LOGMESSAGES
|
||||||
static void InitLogging(void)
|
static void InitLogging(void)
|
||||||
{
|
{
|
||||||
|
@ -243,7 +210,6 @@ int main(int argc, char **argv)
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);
|
prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);
|
||||||
#endif
|
#endif
|
||||||
MakeCodeWritable();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// startup SRB2
|
// startup SRB2
|
||||||
|
|
|
@ -23,12 +23,6 @@
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief SRB2 system stuff for SDL
|
/// \brief SRB2 system stuff for SDL
|
||||||
|
|
||||||
#ifdef CMAKECONFIG
|
|
||||||
#include "config.h"
|
|
||||||
#else
|
|
||||||
#include "../config.h.in"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -331,8 +325,10 @@ static void write_backtrace(INT32 signal)
|
||||||
static void I_ReportSignal(int num, int coredumped)
|
static void I_ReportSignal(int num, int coredumped)
|
||||||
{
|
{
|
||||||
//static char msg[] = "oh no! back to reality!\r\n";
|
//static char msg[] = "oh no! back to reality!\r\n";
|
||||||
const char *sigmsg, *sigttl;
|
const char *sigmsg, *signame;
|
||||||
char ttl[128];
|
char ttl[128];
|
||||||
|
char sigttl[512] = "Process killed by signal: ";
|
||||||
|
const char *reportmsg = "\n\nTo help us figure out the cause, you can visit our official Discord server\nwhere you will find more instructions on how to submit a crash report.\n\nSorry for the inconvenience!";
|
||||||
|
|
||||||
switch (num)
|
switch (num)
|
||||||
{
|
{
|
||||||
|
@ -341,16 +337,16 @@ static void I_ReportSignal(int num, int coredumped)
|
||||||
// sigmsg = "SRB2 was interrupted prematurely by the user.";
|
// sigmsg = "SRB2 was interrupted prematurely by the user.";
|
||||||
// break;
|
// break;
|
||||||
case SIGILL:
|
case SIGILL:
|
||||||
sigmsg = "SRB2 has attempted to execute an illegal instruction and needs to close. %s";
|
sigmsg = "SRB2 has attempted to execute an illegal instruction and needs to close.";
|
||||||
sigttl = "SIGILL"; // illegal instruction - invalid function image
|
signame = "SIGILL"; // illegal instruction - invalid function image
|
||||||
break;
|
break;
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
sigmsg = "SRB2 has encountered a mathematical exception and needs to close. %s";
|
sigmsg = "SRB2 has encountered a mathematical exception and needs to close.";
|
||||||
sigttl = "SIGFPE"; // mathematical exception
|
signame = "SIGFPE"; // mathematical exception
|
||||||
break;
|
break;
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
sigmsg = "SRB2 has attempted to access a memory location that it shouldn't and needs to close. %s";
|
sigmsg = "SRB2 has attempted to access a memory location that it shouldn't and needs to close.";
|
||||||
sigttl = "SIGSEGV"; // segment violation
|
signame = "SIGSEGV"; // segment violation
|
||||||
break;
|
break;
|
||||||
// case SIGTERM:
|
// case SIGTERM:
|
||||||
// sigmsg = "SRB2 was terminated by a kill signal.";
|
// sigmsg = "SRB2 was terminated by a kill signal.";
|
||||||
|
@ -361,34 +357,31 @@ static void I_ReportSignal(int num, int coredumped)
|
||||||
// sigttl = "SIGBREAK" // Ctrl-Break sequence
|
// sigttl = "SIGBREAK" // Ctrl-Break sequence
|
||||||
// break;
|
// break;
|
||||||
case SIGABRT:
|
case SIGABRT:
|
||||||
sigmsg = "SRB2 was terminated by an abort signal. %s";
|
sigmsg = "SRB2 was terminated by an abort signal.";
|
||||||
sigttl = "SIGABRT"; // abnormal termination triggered by abort call
|
signame = "SIGABRT"; // abnormal termination triggered by abort call
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sigmsg = "SRB2 was terminated by an unknown signal. %s";
|
sigmsg = "SRB2 was terminated by an unknown signal.";
|
||||||
|
|
||||||
sprintf(ttl, "number %d", num);
|
sprintf(ttl, "number %d", num);
|
||||||
if (coredumped)
|
if (coredumped)
|
||||||
sigttl = 0;
|
signame = 0;
|
||||||
else
|
else
|
||||||
sigttl = ttl;
|
signame = ttl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coredumped)
|
if (coredumped)
|
||||||
{
|
{
|
||||||
if (sigttl)
|
if (signame)
|
||||||
sprintf(ttl, "%s (core dumped)", sigttl);
|
sprintf(ttl, "%s (core dumped)", signame);
|
||||||
else
|
else
|
||||||
strcat(ttl, " (core dumped)");
|
strcat(ttl, " (core dumped)");
|
||||||
|
|
||||||
sigttl = ttl;
|
signame = ttl;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(ttl, "Process killed by signal: %s", sigttl);
|
strcat(sigttl, signame);
|
||||||
|
I_OutputMsg("%s\n", sigttl);
|
||||||
sigttl = ttl;
|
|
||||||
|
|
||||||
I_OutputMsg("\n%s\n\n", sigttl);
|
|
||||||
|
|
||||||
if (M_CheckParm("-dedicated"))
|
if (M_CheckParm("-dedicated"))
|
||||||
return;
|
return;
|
||||||
|
@ -402,8 +395,7 @@ static void I_ReportSignal(int num, int coredumped)
|
||||||
SDL_MESSAGEBOX_ERROR, /* .flags */
|
SDL_MESSAGEBOX_ERROR, /* .flags */
|
||||||
NULL, /* .window */
|
NULL, /* .window */
|
||||||
sigttl, /* .title */
|
sigttl, /* .title */
|
||||||
va(sigmsg,
|
va("%s %s", sigmsg, reportmsg), /* .message */
|
||||||
"\n\nTo help us figure out the cause, you can visit our official Discord server\nwhere you will find more instructions on how to submit a crash report.\n\nSorry for the inconvenience!"), /* .message */
|
|
||||||
SDL_arraysize(buttons), /* .numbuttons */
|
SDL_arraysize(buttons), /* .numbuttons */
|
||||||
buttons, /* .buttons */
|
buttons, /* .buttons */
|
||||||
NULL /* .colorScheme */
|
NULL /* .colorScheme */
|
||||||
|
@ -2362,7 +2354,10 @@ INT32 I_StartupSystem(void)
|
||||||
#endif
|
#endif
|
||||||
I_StartupConsole();
|
I_StartupConsole();
|
||||||
#ifdef NEWSIGNALHANDLER
|
#ifdef NEWSIGNALHANDLER
|
||||||
I_Fork();
|
// This is useful when debugging. It lets GDB attach to
|
||||||
|
// the correct process easily.
|
||||||
|
if (!M_CheckParm("-nofork"))
|
||||||
|
I_Fork();
|
||||||
#endif
|
#endif
|
||||||
I_RegisterSignals();
|
I_RegisterSignals();
|
||||||
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
|
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
|
||||||
|
@ -2648,9 +2643,10 @@ void I_ShutdownSystem(void)
|
||||||
{
|
{
|
||||||
INT32 c;
|
INT32 c;
|
||||||
|
|
||||||
#ifndef NEWSIGNALHANDLER
|
#ifdef NEWSIGNALHANDLER
|
||||||
I_ShutdownConsole();
|
if (M_CheckParm("-nofork"))
|
||||||
#endif
|
#endif
|
||||||
|
I_ShutdownConsole();
|
||||||
|
|
||||||
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
||||||
if (quit_funcs[c])
|
if (quit_funcs[c])
|
||||||
|
|
|
@ -2512,6 +2512,8 @@ num:
|
||||||
static INT32 ST_drawEmeraldHuntIcon(mobj_t *hunt, patch_t **patches, INT32 offset)
|
static INT32 ST_drawEmeraldHuntIcon(mobj_t *hunt, patch_t **patches, INT32 offset)
|
||||||
{
|
{
|
||||||
INT32 interval, i;
|
INT32 interval, i;
|
||||||
|
if (stplyr->mo == NULL)
|
||||||
|
return 0; // player just joined after spectating, can happen on custom gamemodes.
|
||||||
UINT32 dist = ((UINT32)P_AproxDistance(P_AproxDistance(stplyr->mo->x - hunt->x, stplyr->mo->y - hunt->y), stplyr->mo->z - hunt->z))>>FRACBITS;
|
UINT32 dist = ((UINT32)P_AproxDistance(P_AproxDistance(stplyr->mo->x - hunt->x, stplyr->mo->y - hunt->y), stplyr->mo->z - hunt->z))>>FRACBITS;
|
||||||
|
|
||||||
if (dist < 128)
|
if (dist < 128)
|
||||||
|
|
957
src/tmap.nas
957
src/tmap.nas
|
@ -1,957 +0,0 @@
|
||||||
;; SONIC ROBO BLAST 2
|
|
||||||
;;-----------------------------------------------------------------------------
|
|
||||||
;; Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
;; Copyright (C) 1999-2023 by Sonic Team Junior.
|
|
||||||
;;
|
|
||||||
;; This program is free software distributed under the
|
|
||||||
;; terms of the GNU General Public License, version 2.
|
|
||||||
;; See the 'LICENSE' file for more details.
|
|
||||||
;;-----------------------------------------------------------------------------
|
|
||||||
;; FILE:
|
|
||||||
;; tmap.nas
|
|
||||||
;; DESCRIPTION:
|
|
||||||
;; Assembler optimised rendering code for software mode.
|
|
||||||
;; Draw wall columns.
|
|
||||||
|
|
||||||
|
|
||||||
[BITS 32]
|
|
||||||
|
|
||||||
%define FRACBITS 16
|
|
||||||
%define TRANSPARENTPIXEL 255
|
|
||||||
|
|
||||||
%ifdef LINUX
|
|
||||||
%macro cextern 1
|
|
||||||
[extern %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
%macro cglobal 1
|
|
||||||
[global %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
%else
|
|
||||||
%macro cextern 1
|
|
||||||
%define %1 _%1
|
|
||||||
[extern %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
%macro cglobal 1
|
|
||||||
%define %1 _%1
|
|
||||||
[global %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
; The viddef_s structure. We only need the width field.
|
|
||||||
struc viddef_s
|
|
||||||
resb 12
|
|
||||||
.width: resb 4
|
|
||||||
resb 44
|
|
||||||
endstruc
|
|
||||||
|
|
||||||
;; externs
|
|
||||||
;; columns
|
|
||||||
cextern dc_x
|
|
||||||
cextern dc_yl
|
|
||||||
cextern dc_yh
|
|
||||||
cextern ylookup
|
|
||||||
cextern columnofs
|
|
||||||
cextern dc_source
|
|
||||||
cextern dc_texturemid
|
|
||||||
cextern dc_texheight
|
|
||||||
cextern dc_iscale
|
|
||||||
cextern dc_hires
|
|
||||||
cextern centery
|
|
||||||
cextern centeryfrac
|
|
||||||
cextern dc_colormap
|
|
||||||
cextern dc_transmap
|
|
||||||
cextern colormaps
|
|
||||||
cextern vid
|
|
||||||
cextern topleft
|
|
||||||
|
|
||||||
; DELME
|
|
||||||
cextern R_DrawColumn_8
|
|
||||||
|
|
||||||
; polygon edge rasterizer
|
|
||||||
cextern prastertab
|
|
||||||
|
|
||||||
[SECTION .data]
|
|
||||||
|
|
||||||
;;.align 4
|
|
||||||
loopcount dd 0
|
|
||||||
pixelcount dd 0
|
|
||||||
tystep dd 0
|
|
||||||
|
|
||||||
[SECTION .text]
|
|
||||||
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;;
|
|
||||||
;; R_DrawColumn : 8bpp column drawer
|
|
||||||
;;
|
|
||||||
;; New optimised version 10-01-1998 by D.Fabrice and P.Boris
|
|
||||||
;; Revised by G. Dick July 2010 to support the intervening twelve years'
|
|
||||||
;; worth of changes to the renderer. Since I only vaguely know what I'm
|
|
||||||
;; doing, this is probably rather suboptimal. Help appreciated!
|
|
||||||
;;
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;; fracstep, vid.width in memory
|
|
||||||
;; eax = accumulator
|
|
||||||
;; ebx = colormap
|
|
||||||
;; ecx = count
|
|
||||||
;; edx = heightmask
|
|
||||||
;; esi = source
|
|
||||||
;; edi = dest
|
|
||||||
;; ebp = frac
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
|
|
||||||
cglobal R_DrawColumn_8_ASM
|
|
||||||
; align 16
|
|
||||||
R_DrawColumn_8_ASM:
|
|
||||||
push ebp ;; preserve caller's stack frame pointer
|
|
||||||
push esi ;; preserve register variables
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
;;
|
|
||||||
;; dest = ylookup[dc_yl] + columnofs[dc_x];
|
|
||||||
;;
|
|
||||||
mov ebp,[dc_yl]
|
|
||||||
mov edi,[ylookup+ebp*4]
|
|
||||||
mov ebx,[dc_x]
|
|
||||||
add edi,[columnofs+ebx*4] ;; edi = dest
|
|
||||||
;;
|
|
||||||
;; pixelcount = yh - yl + 1
|
|
||||||
;;
|
|
||||||
mov ecx,[dc_yh]
|
|
||||||
add ecx,1
|
|
||||||
sub ecx,ebp ;; pixel count
|
|
||||||
jle near .done ;; nothing to scale
|
|
||||||
;;
|
|
||||||
;; fracstep = dc_iscale; // But we just use [dc_iscale]
|
|
||||||
;; frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
|
|
||||||
;;
|
|
||||||
mov eax,ebp ;; dc_yl
|
|
||||||
shl eax,FRACBITS
|
|
||||||
sub eax,[centeryfrac]
|
|
||||||
imul dword [dc_iscale]
|
|
||||||
shrd eax,edx,FRACBITS
|
|
||||||
add eax,[dc_texturemid]
|
|
||||||
mov ebp,eax ;; ebp = frac
|
|
||||||
|
|
||||||
mov ebx,[dc_colormap]
|
|
||||||
|
|
||||||
mov esi,[dc_source]
|
|
||||||
;;
|
|
||||||
;; if (dc_hires) frac = 0;
|
|
||||||
;;
|
|
||||||
test byte [dc_hires],0x01
|
|
||||||
jz .texheightcheck
|
|
||||||
xor ebp,ebp
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Check for power of two
|
|
||||||
;;
|
|
||||||
.texheightcheck:
|
|
||||||
mov edx,[dc_texheight]
|
|
||||||
sub edx,1 ;; edx = heightmask
|
|
||||||
test edx,[dc_texheight]
|
|
||||||
jnz .notpowertwo
|
|
||||||
|
|
||||||
test ecx,0x01 ;; Test for odd no. pixels
|
|
||||||
jnz .odd
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Texture height is a power of two, so we get modular arithmetic by
|
|
||||||
;; masking
|
|
||||||
;;
|
|
||||||
.powertwo:
|
|
||||||
mov eax,ebp ;; eax = frac
|
|
||||||
sar eax,FRACBITS ;; Integer part
|
|
||||||
and eax,edx ;; eax &= heightmask
|
|
||||||
movzx eax,byte [esi + eax] ;; eax = texel
|
|
||||||
add ebp,[dc_iscale] ;; frac += fracstep
|
|
||||||
movzx eax,byte [ebx+eax] ;; Map through colormap
|
|
||||||
mov [edi],al ;; Write pixel
|
|
||||||
;; dest += vid.width
|
|
||||||
add edi,[vid + viddef_s.width]
|
|
||||||
|
|
||||||
.odd:
|
|
||||||
mov eax,ebp ;; eax = frac
|
|
||||||
sar eax,FRACBITS ;; Integer part
|
|
||||||
and eax,edx ;; eax &= heightmask
|
|
||||||
movzx eax,byte [esi + eax] ;; eax = texel
|
|
||||||
add ebp,[dc_iscale] ;; frac += fracstep
|
|
||||||
movzx eax,byte [ebx+eax] ;; Map through colormap
|
|
||||||
mov [edi],al ;; Write pixel
|
|
||||||
;; dest += vid.width
|
|
||||||
add edi,[vid + viddef_s.width]
|
|
||||||
|
|
||||||
|
|
||||||
sub ecx,2 ;; count -= 2
|
|
||||||
jg .powertwo
|
|
||||||
|
|
||||||
jmp .done
|
|
||||||
|
|
||||||
.notpowertwo:
|
|
||||||
add edx,1
|
|
||||||
shl edx,FRACBITS
|
|
||||||
test ebp,ebp
|
|
||||||
jns .notpowtwoloop
|
|
||||||
|
|
||||||
.makefracpos:
|
|
||||||
add ebp,edx ;; frac is negative; make it positive
|
|
||||||
js .makefracpos
|
|
||||||
|
|
||||||
.notpowtwoloop:
|
|
||||||
cmp ebp,edx ;; Reduce mod height
|
|
||||||
jl .writenonpowtwo
|
|
||||||
sub ebp,edx
|
|
||||||
jmp .notpowtwoloop
|
|
||||||
|
|
||||||
.writenonpowtwo:
|
|
||||||
mov eax,ebp ;; eax = frac
|
|
||||||
sar eax,FRACBITS ;; Integer part.
|
|
||||||
mov bl,[esi + eax] ;; ebx = colormap + texel
|
|
||||||
add ebp,[dc_iscale] ;; frac += fracstep
|
|
||||||
movzx eax,byte [ebx] ;; Map through colormap
|
|
||||||
mov [edi],al ;; Write pixel
|
|
||||||
;; dest += vid.width
|
|
||||||
add edi,[vid + viddef_s.width]
|
|
||||||
|
|
||||||
sub ecx,1
|
|
||||||
jnz .notpowtwoloop
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
.done:
|
|
||||||
pop ebx ;; restore register variables
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebp ;; restore caller's stack frame pointer
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;;
|
|
||||||
;; R_Draw2sMultiPatchColumn : Like R_DrawColumn, but omits transparent
|
|
||||||
;; pixels.
|
|
||||||
;;
|
|
||||||
;; New optimised version 10-01-1998 by D.Fabrice and P.Boris
|
|
||||||
;; Revised by G. Dick July 2010 to support the intervening twelve years'
|
|
||||||
;; worth of changes to the renderer. Since I only vaguely know what I'm
|
|
||||||
;; doing, this is probably rather suboptimal. Help appreciated!
|
|
||||||
;;
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;; fracstep, vid.width in memory
|
|
||||||
;; eax = accumulator
|
|
||||||
;; ebx = colormap
|
|
||||||
;; ecx = count
|
|
||||||
;; edx = heightmask
|
|
||||||
;; esi = source
|
|
||||||
;; edi = dest
|
|
||||||
;; ebp = frac
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
|
|
||||||
cglobal R_Draw2sMultiPatchColumn_8_ASM
|
|
||||||
; align 16
|
|
||||||
R_Draw2sMultiPatchColumn_8_ASM:
|
|
||||||
push ebp ;; preserve caller's stack frame pointer
|
|
||||||
push esi ;; preserve register variables
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
;;
|
|
||||||
;; dest = ylookup[dc_yl] + columnofs[dc_x];
|
|
||||||
;;
|
|
||||||
mov ebp,[dc_yl]
|
|
||||||
mov edi,[ylookup+ebp*4]
|
|
||||||
mov ebx,[dc_x]
|
|
||||||
add edi,[columnofs+ebx*4] ;; edi = dest
|
|
||||||
;;
|
|
||||||
;; pixelcount = yh - yl + 1
|
|
||||||
;;
|
|
||||||
mov ecx,[dc_yh]
|
|
||||||
add ecx,1
|
|
||||||
sub ecx,ebp ;; pixel count
|
|
||||||
jle near .done ;; nothing to scale
|
|
||||||
;;
|
|
||||||
;; fracstep = dc_iscale; // But we just use [dc_iscale]
|
|
||||||
;; frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
|
|
||||||
;;
|
|
||||||
mov eax,ebp ;; dc_yl
|
|
||||||
shl eax,FRACBITS
|
|
||||||
sub eax,[centeryfrac]
|
|
||||||
imul dword [dc_iscale]
|
|
||||||
shrd eax,edx,FRACBITS
|
|
||||||
add eax,[dc_texturemid]
|
|
||||||
mov ebp,eax ;; ebp = frac
|
|
||||||
|
|
||||||
mov ebx,[dc_colormap]
|
|
||||||
|
|
||||||
mov esi,[dc_source]
|
|
||||||
;;
|
|
||||||
;; if (dc_hires) frac = 0;
|
|
||||||
;;
|
|
||||||
test byte [dc_hires],0x01
|
|
||||||
jz .texheightcheck
|
|
||||||
xor ebp,ebp
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Check for power of two
|
|
||||||
;;
|
|
||||||
.texheightcheck:
|
|
||||||
mov edx,[dc_texheight]
|
|
||||||
sub edx,1 ;; edx = heightmask
|
|
||||||
test edx,[dc_texheight]
|
|
||||||
jnz .notpowertwo
|
|
||||||
|
|
||||||
test ecx,0x01 ;; Test for odd no. pixels
|
|
||||||
jnz .odd
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Texture height is a power of two, so we get modular arithmetic by
|
|
||||||
;; masking
|
|
||||||
;;
|
|
||||||
.powertwo:
|
|
||||||
mov eax,ebp ;; eax = frac
|
|
||||||
sar eax,FRACBITS ;; Integer part
|
|
||||||
and eax,edx ;; eax &= heightmask
|
|
||||||
movzx eax,byte [esi + eax] ;; eax = texel
|
|
||||||
add ebp,[dc_iscale] ;; frac += fracstep
|
|
||||||
cmp al,TRANSPARENTPIXEL ;; Is pixel transparent?
|
|
||||||
je .nextpowtwoeven ;; If so, advance.
|
|
||||||
movzx eax,byte [ebx+eax] ;; Map through colormap
|
|
||||||
mov [edi],al ;; Write pixel
|
|
||||||
.nextpowtwoeven:
|
|
||||||
;; dest += vid.width
|
|
||||||
add edi,[vid + viddef_s.width]
|
|
||||||
|
|
||||||
.odd:
|
|
||||||
mov eax,ebp ;; eax = frac
|
|
||||||
sar eax,FRACBITS ;; Integer part
|
|
||||||
and eax,edx ;; eax &= heightmask
|
|
||||||
movzx eax,byte [esi + eax] ;; eax = texel
|
|
||||||
add ebp,[dc_iscale] ;; frac += fracstep
|
|
||||||
cmp al,TRANSPARENTPIXEL ;; Is pixel transparent?
|
|
||||||
je .nextpowtwoodd ;; If so, advance.
|
|
||||||
movzx eax,byte [ebx+eax] ;; Map through colormap
|
|
||||||
mov [edi],al ;; Write pixel
|
|
||||||
.nextpowtwoodd:
|
|
||||||
;; dest += vid.width
|
|
||||||
add edi,[vid + viddef_s.width]
|
|
||||||
|
|
||||||
|
|
||||||
sub ecx,2 ;; count -= 2
|
|
||||||
jg .powertwo
|
|
||||||
|
|
||||||
jmp .done
|
|
||||||
|
|
||||||
.notpowertwo:
|
|
||||||
add edx,1
|
|
||||||
shl edx,FRACBITS
|
|
||||||
test ebp,ebp
|
|
||||||
jns .notpowtwoloop
|
|
||||||
|
|
||||||
.makefracpos:
|
|
||||||
add ebp,edx ;; frac is negative; make it positive
|
|
||||||
js .makefracpos
|
|
||||||
|
|
||||||
.notpowtwoloop:
|
|
||||||
cmp ebp,edx ;; Reduce mod height
|
|
||||||
jl .writenonpowtwo
|
|
||||||
sub ebp,edx
|
|
||||||
jmp .notpowtwoloop
|
|
||||||
|
|
||||||
.writenonpowtwo:
|
|
||||||
mov eax,ebp ;; eax = frac
|
|
||||||
sar eax,FRACBITS ;; Integer part.
|
|
||||||
mov bl,[esi + eax] ;; ebx = colormap + texel
|
|
||||||
add ebp,[dc_iscale] ;; frac += fracstep
|
|
||||||
cmp bl,TRANSPARENTPIXEL ;; Is pixel transparent?
|
|
||||||
je .nextnonpowtwo ;; If so, advance.
|
|
||||||
movzx eax,byte [ebx] ;; Map through colormap
|
|
||||||
mov [edi],al ;; Write pixel
|
|
||||||
.nextnonpowtwo:
|
|
||||||
;; dest += vid.width
|
|
||||||
add edi,[vid + viddef_s.width]
|
|
||||||
|
|
||||||
sub ecx,1
|
|
||||||
jnz .notpowtwoloop
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
.done:
|
|
||||||
pop ebx ;; restore register variables
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebp ;; restore caller's stack frame pointer
|
|
||||||
ret
|
|
||||||
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;; R_DrawTranslucentColumnA_8
|
|
||||||
;;
|
|
||||||
;; Vertical column texture drawer, with transparency. Replaces Doom2's
|
|
||||||
;; 'fuzz' effect, which was not so beautiful.
|
|
||||||
;; Transparency is always impressive in some way, don't know why...
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
|
|
||||||
cglobal R_DrawTranslucentColumn_8_ASM
|
|
||||||
R_DrawTranslucentColumn_8_ASM:
|
|
||||||
push ebp ;; preserve caller's stack frame pointer
|
|
||||||
push esi ;; preserve register variables
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
;;
|
|
||||||
;; dest = ylookup[dc_yl] + columnofs[dc_x];
|
|
||||||
;;
|
|
||||||
mov ebp,[dc_yl]
|
|
||||||
mov ebx,ebp
|
|
||||||
mov edi,[ylookup+ebx*4]
|
|
||||||
mov ebx,[dc_x]
|
|
||||||
add edi,[columnofs+ebx*4] ;; edi = dest
|
|
||||||
;;
|
|
||||||
;; pixelcount = yh - yl + 1
|
|
||||||
;;
|
|
||||||
mov eax,[dc_yh]
|
|
||||||
inc eax
|
|
||||||
sub eax,ebp ;; pixel count
|
|
||||||
mov [pixelcount],eax ;; save for final pixel
|
|
||||||
jle near vtdone ;; nothing to scale
|
|
||||||
;;
|
|
||||||
;; frac = dc_texturemid - (centery-dc_yl)*fracstep;
|
|
||||||
;;
|
|
||||||
mov ecx,[dc_iscale] ;; fracstep
|
|
||||||
mov eax,[centery]
|
|
||||||
sub eax,ebp
|
|
||||||
imul eax,ecx
|
|
||||||
mov edx,[dc_texturemid]
|
|
||||||
sub edx,eax
|
|
||||||
mov ebx,edx
|
|
||||||
|
|
||||||
shr ebx,16 ;; frac int.
|
|
||||||
and ebx,0x7f
|
|
||||||
shl edx,16 ;; y frac up
|
|
||||||
|
|
||||||
mov ebp,ecx
|
|
||||||
shl ebp,16 ;; fracstep f. up
|
|
||||||
shr ecx,16 ;; fracstep i. ->cl
|
|
||||||
and cl,0x7f
|
|
||||||
push cx
|
|
||||||
mov ecx,edx
|
|
||||||
pop cx
|
|
||||||
mov edx,[dc_colormap]
|
|
||||||
mov esi,[dc_source]
|
|
||||||
;;
|
|
||||||
;; lets rock :) !
|
|
||||||
;;
|
|
||||||
mov eax,[pixelcount]
|
|
||||||
shr eax,0x2
|
|
||||||
test byte [pixelcount],0x3
|
|
||||||
mov ch,al ;; quad count
|
|
||||||
mov eax,[dc_transmap]
|
|
||||||
je vt4quadloop
|
|
||||||
;;
|
|
||||||
;; do un-even pixel
|
|
||||||
;;
|
|
||||||
test byte [pixelcount],0x1
|
|
||||||
je trf2
|
|
||||||
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
add ecx,ebp
|
|
||||||
adc bl,cl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov dl,[edx]
|
|
||||||
mov [edi],dl
|
|
||||||
pf: add edi,0x12345678
|
|
||||||
;;
|
|
||||||
;; do two non-quad-aligned pixels
|
|
||||||
;;
|
|
||||||
trf2: test byte [pixelcount],0x2
|
|
||||||
je trf3
|
|
||||||
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
add ecx,ebp
|
|
||||||
adc bl,cl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov dl,[edx]
|
|
||||||
mov [edi],dl
|
|
||||||
pg: add edi,0x12345678
|
|
||||||
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
add ecx,ebp
|
|
||||||
adc bl,cl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov dl,[edx]
|
|
||||||
mov [edi],dl
|
|
||||||
ph: add edi,0x12345678
|
|
||||||
;;
|
|
||||||
;; test if there was at least 4 pixels
|
|
||||||
;;
|
|
||||||
trf3: test ch,0xff ;; test quad count
|
|
||||||
je near vtdone
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; ebp : ystep frac. upper 24 bits
|
|
||||||
;; edx : y frac. upper 24 bits
|
|
||||||
;; ebx : y i. lower 7 bits, masked for index
|
|
||||||
;; ecx : ch = counter, cl = y step i.
|
|
||||||
;; eax : colormap aligned 256
|
|
||||||
;; esi : source texture column
|
|
||||||
;; edi : dest screen
|
|
||||||
;;
|
|
||||||
vt4quadloop:
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov [tystep],ebp
|
|
||||||
pi: add edi,0x12345678
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
pj: sub edi,0x12345678
|
|
||||||
mov ebp,edi
|
|
||||||
pk: sub edi,0x12345678
|
|
||||||
jmp short inloop
|
|
||||||
align 4
|
|
||||||
vtquadloop:
|
|
||||||
add ecx,[tystep]
|
|
||||||
adc bl,cl
|
|
||||||
q1: add ebp,0x23456789
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov dl,[edx]
|
|
||||||
mov [edi],dl
|
|
||||||
mov al,[ebp] ;; fetch dest : index into colormap
|
|
||||||
inloop:
|
|
||||||
add ecx,[tystep]
|
|
||||||
adc bl,cl
|
|
||||||
q2: add edi,0x23456789
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov dl,[edx]
|
|
||||||
mov [ebp+0x0],dl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
|
|
||||||
add ecx,[tystep]
|
|
||||||
adc bl,cl
|
|
||||||
q3: add ebp,0x23456789
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov dl,[edx]
|
|
||||||
mov [edi],dl
|
|
||||||
mov al,[ebp] ;; fetch dest : index into colormap
|
|
||||||
|
|
||||||
add ecx,[tystep]
|
|
||||||
adc bl,cl
|
|
||||||
q4: add edi,0x23456789
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov dl,[edx]
|
|
||||||
mov [ebp],dl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
|
|
||||||
dec ch
|
|
||||||
jne vtquadloop
|
|
||||||
vtdone:
|
|
||||||
pop ebx
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;; R_DrawShadeColumn
|
|
||||||
;;
|
|
||||||
;; for smoke..etc.. test.
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
cglobal R_DrawShadeColumn_8_ASM
|
|
||||||
R_DrawShadeColumn_8_ASM:
|
|
||||||
push ebp ;; preserve caller's stack frame pointer
|
|
||||||
push esi ;; preserve register variables
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; dest = ylookup[dc_yl] + columnofs[dc_x];
|
|
||||||
;;
|
|
||||||
mov ebp,[dc_yl]
|
|
||||||
mov ebx,ebp
|
|
||||||
mov edi,[ylookup+ebx*4]
|
|
||||||
mov ebx,[dc_x]
|
|
||||||
add edi,[columnofs+ebx*4] ;; edi = dest
|
|
||||||
;;
|
|
||||||
;; pixelcount = yh - yl + 1
|
|
||||||
;;
|
|
||||||
mov eax,[dc_yh]
|
|
||||||
inc eax
|
|
||||||
sub eax,ebp ;; pixel count
|
|
||||||
mov [pixelcount],eax ;; save for final pixel
|
|
||||||
jle near shdone ;; nothing to scale
|
|
||||||
;;
|
|
||||||
;; frac = dc_texturemid - (centery-dc_yl)*fracstep;
|
|
||||||
;;
|
|
||||||
mov ecx,[dc_iscale] ;; fracstep
|
|
||||||
mov eax,[centery]
|
|
||||||
sub eax,ebp
|
|
||||||
imul eax,ecx
|
|
||||||
mov edx,[dc_texturemid]
|
|
||||||
sub edx,eax
|
|
||||||
mov ebx,edx
|
|
||||||
shr ebx,16 ;; frac int.
|
|
||||||
and ebx,byte +0x7f
|
|
||||||
shl edx,16 ;; y frac up
|
|
||||||
|
|
||||||
mov ebp,ecx
|
|
||||||
shl ebp,16 ;; fracstep f. up
|
|
||||||
shr ecx,16 ;; fracstep i. ->cl
|
|
||||||
and cl,0x7f
|
|
||||||
|
|
||||||
mov esi,[dc_source]
|
|
||||||
;;
|
|
||||||
;; lets rock :) !
|
|
||||||
;;
|
|
||||||
mov eax,[pixelcount]
|
|
||||||
mov dh,al
|
|
||||||
shr eax,2
|
|
||||||
mov ch,al ;; quad count
|
|
||||||
mov eax,[colormaps]
|
|
||||||
test dh,3
|
|
||||||
je sh4quadloop
|
|
||||||
;;
|
|
||||||
;; do un-even pixel
|
|
||||||
;;
|
|
||||||
test dh,0x1
|
|
||||||
je shf2
|
|
||||||
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
add edx,ebp
|
|
||||||
adc bl,cl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov [edi],dl
|
|
||||||
pl: add edi,0x12345678
|
|
||||||
;;
|
|
||||||
;; do two non-quad-aligned pixels
|
|
||||||
;;
|
|
||||||
shf2:
|
|
||||||
test dh,0x2
|
|
||||||
je shf3
|
|
||||||
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
add edx,ebp
|
|
||||||
adc bl,cl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov [edi],dl
|
|
||||||
pm: add edi,0x12345678
|
|
||||||
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
add edx,ebp
|
|
||||||
adc bl,cl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
and bl,0x7f
|
|
||||||
mov dl,[eax]
|
|
||||||
mov [edi],dl
|
|
||||||
pn: add edi,0x12345678
|
|
||||||
;;
|
|
||||||
;; test if there was at least 4 pixels
|
|
||||||
;;
|
|
||||||
shf3:
|
|
||||||
test ch,0xff ;; test quad count
|
|
||||||
je near shdone
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; ebp : ystep frac. upper 24 bits
|
|
||||||
;; edx : y frac. upper 24 bits
|
|
||||||
;; ebx : y i. lower 7 bits, masked for index
|
|
||||||
;; ecx : ch = counter, cl = y step i.
|
|
||||||
;; eax : colormap aligned 256
|
|
||||||
;; esi : source texture column
|
|
||||||
;; edi : dest screen
|
|
||||||
;;
|
|
||||||
sh4quadloop:
|
|
||||||
mov dh,0x7f ;; prep mask
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov [tystep],ebp
|
|
||||||
po: add edi,0x12345678
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
pp: sub edi,0x12345678
|
|
||||||
mov ebp,edi
|
|
||||||
pq: sub edi,0x12345678
|
|
||||||
jmp short shinloop
|
|
||||||
|
|
||||||
align 4
|
|
||||||
shquadloop:
|
|
||||||
add edx,[tystep]
|
|
||||||
adc bl,cl
|
|
||||||
and bl,dh
|
|
||||||
q5: add ebp,0x12345678
|
|
||||||
mov dl,[eax]
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov [edi],dl
|
|
||||||
mov al,[ebp] ;; fetch dest : index into colormap
|
|
||||||
shinloop:
|
|
||||||
add edx,[tystep]
|
|
||||||
adc bl,cl
|
|
||||||
and bl,dh
|
|
||||||
q6: add edi,0x12345678
|
|
||||||
mov dl,[eax]
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov [ebp],dl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
|
|
||||||
add edx,[tystep]
|
|
||||||
adc bl,cl
|
|
||||||
and bl,dh
|
|
||||||
q7: add ebp,0x12345678
|
|
||||||
mov dl,[eax]
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov [edi],dl
|
|
||||||
mov al,[ebp] ;; fetch dest : index into colormap
|
|
||||||
|
|
||||||
add edx,[tystep]
|
|
||||||
adc bl,cl
|
|
||||||
and bl,dh
|
|
||||||
q8: add edi,0x12345678
|
|
||||||
mov dl,[eax]
|
|
||||||
mov ah,[esi+ebx] ;; fetch texel : colormap number
|
|
||||||
mov [ebp],dl
|
|
||||||
mov al,[edi] ;; fetch dest : index into colormap
|
|
||||||
|
|
||||||
dec ch
|
|
||||||
jne shquadloop
|
|
||||||
|
|
||||||
shdone:
|
|
||||||
pop ebx ;; restore register variables
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebp ;; restore caller's stack frame pointer
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
;; ========================================================================
|
|
||||||
;; Rasterization of the segments of a LINEAR polygne textur of manire.
|
|
||||||
;; It is thus a question of interpolating coordinate them at the edges of texture in
|
|
||||||
;; the time that the X-coordinates minx/maxx for each line.
|
|
||||||
;; the argument ' dir' indicates which edges of texture are Interpol?:
|
|
||||||
;; 0: segments associs at edge TOP? and BOTTOM? (constant TY)
|
|
||||||
;; 1: segments associs at the LEFT and RIGHT edge (constant TX)
|
|
||||||
;; ========================================================================
|
|
||||||
;;
|
|
||||||
;; void rasterize_segment_tex( LONG x1, LONG y1, LONG x2, LONG y2, LONG tv1, LONG tv2, LONG tc, LONG dir );
|
|
||||||
;; ARG1 ARG2 ARG3 ARG4 ARG5 ARG6 ARG7 ARG8
|
|
||||||
;;
|
|
||||||
;; Pour dir = 0, (tv1,tv2) = (tX1,tX2), tc = tY, en effet TY est constant.
|
|
||||||
;;
|
|
||||||
;; Pour dir = 1, (tv1,tv2) = (tY1,tY2), tc = tX, en effet TX est constant.
|
|
||||||
;;
|
|
||||||
;;
|
|
||||||
;; Uses: extern struct rastery *_rastertab;
|
|
||||||
;;
|
|
||||||
|
|
||||||
MINX EQU 0
|
|
||||||
MAXX EQU 4
|
|
||||||
TX1 EQU 8
|
|
||||||
TY1 EQU 12
|
|
||||||
TX2 EQU 16
|
|
||||||
TY2 EQU 20
|
|
||||||
RASTERY_SIZEOF EQU 24
|
|
||||||
|
|
||||||
cglobal rasterize_segment_tex_asm
|
|
||||||
rasterize_segment_tex_asm:
|
|
||||||
push ebp
|
|
||||||
mov ebp,esp
|
|
||||||
|
|
||||||
sub esp,byte +0x8 ;; allocate the local variables
|
|
||||||
|
|
||||||
push ebx
|
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
o16 mov ax,es
|
|
||||||
push eax
|
|
||||||
|
|
||||||
;; #define DX [ebp-4]
|
|
||||||
;; #define TD [ebp-8]
|
|
||||||
|
|
||||||
mov eax,[ebp+0xc] ;; y1
|
|
||||||
mov ebx,[ebp+0x14] ;; y2
|
|
||||||
cmp ebx,eax
|
|
||||||
je near .L_finished ;; special (y1==y2) segment horizontal, exit!
|
|
||||||
|
|
||||||
jg near .L_rasterize_right
|
|
||||||
|
|
||||||
;;rasterize_left: ;; one rasterize a segment LEFT of the polygne
|
|
||||||
|
|
||||||
mov ecx,eax
|
|
||||||
sub ecx,ebx
|
|
||||||
inc ecx ;; y1-y2+1
|
|
||||||
|
|
||||||
mov eax,RASTERY_SIZEOF
|
|
||||||
mul ebx ;; * y2
|
|
||||||
mov esi,[prastertab]
|
|
||||||
add esi,eax ;; point into rastertab[y2]
|
|
||||||
|
|
||||||
mov eax,[ebp+0x8] ;; ARG1
|
|
||||||
sub eax,[ebp+0x10] ;; ARG3
|
|
||||||
shl eax,0x10 ;; ((x1-x2)<<PRE) ...
|
|
||||||
cdq
|
|
||||||
idiv ecx ;; dx = ... / (y1-y2+1)
|
|
||||||
mov [ebp-0x4],eax ;; DX
|
|
||||||
|
|
||||||
mov eax,[ebp+0x18] ;; ARG5
|
|
||||||
sub eax,[ebp+0x1c] ;; ARG6
|
|
||||||
shl eax,0x10
|
|
||||||
cdq
|
|
||||||
idiv ecx ;; tdx =((tx1-tx2)<<PRE) / (y1-y2+1)
|
|
||||||
mov [ebp-0x8],eax ;; idem tdy =((ty1-ty2)<<PRE) / (y1-y2+1)
|
|
||||||
|
|
||||||
mov eax,[ebp+0x10] ;; ARG3
|
|
||||||
shl eax,0x10 ;; x = x2<<PRE
|
|
||||||
|
|
||||||
mov ebx,[ebp+0x1c] ;; ARG6
|
|
||||||
shl ebx,0x10 ;; tx = tx2<<PRE d0
|
|
||||||
;; ty = ty2<<PRE d1
|
|
||||||
mov edx,[ebp+0x20] ;; ARG7
|
|
||||||
shl edx,0x10 ;; ty = ty<<PRE d0
|
|
||||||
;; tx = tx<<PRE d1
|
|
||||||
push ebp
|
|
||||||
mov edi,[ebp-0x4] ;; DX
|
|
||||||
cmp dword [ebp+0x24],byte +0x0 ;; ARG8 direction ?
|
|
||||||
|
|
||||||
mov ebp,[ebp-0x8] ;; TD
|
|
||||||
je .L_rleft_h_loop
|
|
||||||
;;
|
|
||||||
;; TY varies, TX is constant
|
|
||||||
;;
|
|
||||||
.L_rleft_v_loop:
|
|
||||||
mov [esi+MINX],eax ;; rastertab[y].minx = x
|
|
||||||
add ebx,ebp
|
|
||||||
mov [esi+TX1],edx ;; .tx1 = tx
|
|
||||||
add eax,edi
|
|
||||||
mov [esi+TY1],ebx ;; .ty1 = ty
|
|
||||||
|
|
||||||
;;addl DX, %eax // x += dx
|
|
||||||
;;addl TD, %ebx // ty += tdy
|
|
||||||
|
|
||||||
add esi,RASTERY_SIZEOF ;; next raster line into rastertab[]
|
|
||||||
dec ecx
|
|
||||||
jne .L_rleft_v_loop
|
|
||||||
pop ebp
|
|
||||||
jmp .L_finished
|
|
||||||
;;
|
|
||||||
;; TX varies, TY is constant
|
|
||||||
;;
|
|
||||||
.L_rleft_h_loop:
|
|
||||||
mov [esi+MINX],eax ;; rastertab[y].minx = x
|
|
||||||
add eax,edi
|
|
||||||
mov [esi+TX1],ebx ;; .tx1 = tx
|
|
||||||
add ebx,ebp
|
|
||||||
mov [esi+TY1],edx ;; .ty1 = ty
|
|
||||||
|
|
||||||
;;addl DX, %eax // x += dx
|
|
||||||
;;addl TD, %ebx // tx += tdx
|
|
||||||
|
|
||||||
add esi,RASTERY_SIZEOF ;; next raster line into rastertab[]
|
|
||||||
dec ecx
|
|
||||||
jne .L_rleft_h_loop
|
|
||||||
pop ebp
|
|
||||||
jmp .L_finished
|
|
||||||
;;
|
|
||||||
;; one rasterize a segment LINE of the polygne
|
|
||||||
;;
|
|
||||||
.L_rasterize_right:
|
|
||||||
mov ecx,ebx
|
|
||||||
sub ecx,eax
|
|
||||||
inc ecx ;; y2-y1+1
|
|
||||||
|
|
||||||
mov ebx,RASTERY_SIZEOF
|
|
||||||
mul ebx ;; * y1
|
|
||||||
mov esi,[prastertab]
|
|
||||||
add esi,eax ;; point into rastertab[y1]
|
|
||||||
|
|
||||||
mov eax,[ebp+0x10] ;; ARG3
|
|
||||||
sub eax,[ebp+0x8] ;; ARG1
|
|
||||||
shl eax,0x10 ;; ((x2-x1)<<PRE) ...
|
|
||||||
cdq
|
|
||||||
idiv ecx ;; dx = ... / (y2-y1+1)
|
|
||||||
mov [ebp-0x4],eax ;; DX
|
|
||||||
|
|
||||||
mov eax,[ebp+0x1c] ;; ARG6
|
|
||||||
sub eax,[ebp+0x18] ;; ARG5
|
|
||||||
shl eax,0x10
|
|
||||||
cdq
|
|
||||||
idiv ecx ;; tdx =((tx2-tx1)<<PRE) / (y2-y1+1)
|
|
||||||
mov [ebp-0x8],eax ;; idem tdy =((ty2-ty1)<<PRE) / (y2-y1+1)
|
|
||||||
|
|
||||||
mov eax,[ebp+0x8] ;; ARG1
|
|
||||||
shl eax,0x10 ;; x = x1<<PRE
|
|
||||||
|
|
||||||
mov ebx,[ebp+0x18] ;; ARG5
|
|
||||||
shl ebx,0x10 ;; tx = tx1<<PRE d0
|
|
||||||
;; ty = ty1<<PRE d1
|
|
||||||
mov edx,[ebp+0x20] ;; ARG7
|
|
||||||
shl edx,0x10 ;; ty = ty<<PRE d0
|
|
||||||
;; tx = tx<<PRE d1
|
|
||||||
push ebp
|
|
||||||
mov edi,[ebp-0x4] ;; DX
|
|
||||||
|
|
||||||
cmp dword [ebp+0x24], 0 ;; direction ?
|
|
||||||
|
|
||||||
mov ebp,[ebp-0x8] ;; TD
|
|
||||||
je .L_rright_h_loop
|
|
||||||
;;
|
|
||||||
;; TY varies, TX is constant
|
|
||||||
;;
|
|
||||||
.L_rright_v_loop:
|
|
||||||
|
|
||||||
mov [esi+MAXX],eax ;; rastertab[y].maxx = x
|
|
||||||
add ebx,ebp
|
|
||||||
mov [esi+TX2],edx ;; .tx2 = tx
|
|
||||||
add eax,edi
|
|
||||||
mov [esi+TY2],ebx ;; .ty2 = ty
|
|
||||||
|
|
||||||
;;addl DX, %eax // x += dx
|
|
||||||
;;addl TD, %ebx // ty += tdy
|
|
||||||
|
|
||||||
add esi,RASTERY_SIZEOF
|
|
||||||
dec ecx
|
|
||||||
jne .L_rright_v_loop
|
|
||||||
|
|
||||||
pop ebp
|
|
||||||
|
|
||||||
jmp short .L_finished
|
|
||||||
;;
|
|
||||||
;; TX varies, TY is constant
|
|
||||||
;;
|
|
||||||
.L_rright_h_loop:
|
|
||||||
mov [esi+MAXX],eax ;; rastertab[y].maxx = x
|
|
||||||
add eax,edi
|
|
||||||
mov [esi+TX2],ebx ;; .tx2 = tx
|
|
||||||
add ebx,ebp
|
|
||||||
mov [esi+TY2],edx ;; .ty2 = ty
|
|
||||||
|
|
||||||
;;addl DX, %eax // x += dx
|
|
||||||
;;addl TD, %ebx // tx += tdx
|
|
||||||
|
|
||||||
add esi,RASTERY_SIZEOF
|
|
||||||
dec ecx
|
|
||||||
jne .L_rright_h_loop
|
|
||||||
|
|
||||||
pop ebp
|
|
||||||
|
|
||||||
.L_finished:
|
|
||||||
pop eax
|
|
||||||
o16 mov es,ax
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebx
|
|
||||||
|
|
||||||
mov esp,ebp
|
|
||||||
pop ebp
|
|
||||||
ret
|
|
1587
src/tmap.s
1587
src/tmap.s
File diff suppressed because it is too large
Load diff
322
src/tmap_asm.s
322
src/tmap_asm.s
|
@ -1,322 +0,0 @@
|
||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
// Copyright (C) 1999-2023 by Sonic Team Junior.
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file tmap_asm.s
|
|
||||||
/// \brief ???
|
|
||||||
|
|
||||||
//.comm _dc_colormap,4
|
|
||||||
//.comm _dc_x,4
|
|
||||||
//.comm _dc_yl,4
|
|
||||||
//.comm _dc_yh,4
|
|
||||||
//.comm _dc_iscale,4
|
|
||||||
//.comm _dc_texturemid,4
|
|
||||||
//.comm _dc_source,4
|
|
||||||
//.comm _ylookup,4
|
|
||||||
//.comm _columnofs,4
|
|
||||||
//.comm _loopcount,4
|
|
||||||
//.comm _pixelcount,4
|
|
||||||
.data
|
|
||||||
_pixelcount:
|
|
||||||
.long 0x00000000
|
|
||||||
_loopcount:
|
|
||||||
.long 0x00000000
|
|
||||||
.align 8
|
|
||||||
_mmxcomm:
|
|
||||||
.long 0x00000000
|
|
||||||
.text
|
|
||||||
|
|
||||||
.align 4
|
|
||||||
.globl _R_DrawColumn8_NOMMX
|
|
||||||
_R_DrawColumn8_NOMMX:
|
|
||||||
pushl %ebp
|
|
||||||
pushl %esi
|
|
||||||
pushl %edi
|
|
||||||
pushl %ebx
|
|
||||||
movl _dc_yl,%edx
|
|
||||||
movl _dc_yh,%eax
|
|
||||||
subl %edx,%eax
|
|
||||||
leal 1(%eax),%ebx
|
|
||||||
testl %ebx,%ebx
|
|
||||||
jle rdc8ndone
|
|
||||||
movl _dc_x,%eax
|
|
||||||
movl _ylookup, %edi
|
|
||||||
movl (%edi,%edx,4),%esi
|
|
||||||
movl _columnofs, %edi
|
|
||||||
addl (%edi,%eax,4),%esi
|
|
||||||
movl _dc_iscale,%edi
|
|
||||||
movl %edx,%eax
|
|
||||||
imull %edi,%eax
|
|
||||||
movl _dc_texturemid,%ecx
|
|
||||||
addl %eax,%ecx
|
|
||||||
|
|
||||||
movl _dc_source,%ebp
|
|
||||||
xorl %edx, %edx
|
|
||||||
subl $0x12345678, %esi
|
|
||||||
.globl rdc8nwidth1
|
|
||||||
rdc8nwidth1:
|
|
||||||
.align 4,0x90
|
|
||||||
rdc8nloop:
|
|
||||||
movl %ecx,%eax
|
|
||||||
shrl $16,%eax
|
|
||||||
addl %edi,%ecx
|
|
||||||
andl $127,%eax
|
|
||||||
addl $0x12345678,%esi
|
|
||||||
.globl rdc8nwidth2
|
|
||||||
rdc8nwidth2:
|
|
||||||
movb (%eax,%ebp),%dl
|
|
||||||
movl _dc_colormap,%eax
|
|
||||||
movb (%eax,%edx),%al
|
|
||||||
movb %al,(%esi)
|
|
||||||
decl %ebx
|
|
||||||
jne rdc8nloop
|
|
||||||
rdc8ndone:
|
|
||||||
popl %ebx
|
|
||||||
popl %edi
|
|
||||||
popl %esi
|
|
||||||
popl %ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
//
|
|
||||||
// Optimised specifically for P54C/P55C (aka Pentium with/without MMX)
|
|
||||||
// By ES 1998/08/01
|
|
||||||
//
|
|
||||||
|
|
||||||
.globl _R_DrawColumn_8_Pentium
|
|
||||||
_R_DrawColumn_8_Pentium:
|
|
||||||
pushl %ebp
|
|
||||||
pushl %ebx
|
|
||||||
pushl %esi
|
|
||||||
pushl %edi
|
|
||||||
movl _dc_yl,%eax // Top pixel
|
|
||||||
movl _dc_yh,%ebx // Bottom pixel
|
|
||||||
movl _ylookup, %edi
|
|
||||||
movl (%edi,%ebx,4),%ecx
|
|
||||||
subl %eax,%ebx // ebx=number of pixels-1
|
|
||||||
jl rdc8pdone // no pixel to draw, done
|
|
||||||
jnz rdc8pmany
|
|
||||||
movl _dc_x,%edx // Special case: only one pixel
|
|
||||||
movl _columnofs, %edi
|
|
||||||
addl (%edi,%edx,4),%ecx // dest pixel at (%ecx)
|
|
||||||
movl _dc_iscale,%esi
|
|
||||||
imull %esi,%eax
|
|
||||||
movl _dc_texturemid,%edi
|
|
||||||
addl %eax,%edi // texture index in edi
|
|
||||||
movl _dc_colormap,%edx
|
|
||||||
shrl $16, %edi
|
|
||||||
movl _dc_source,%ebp
|
|
||||||
andl $127,%edi
|
|
||||||
movb (%edi,%ebp),%dl // read texture pixel
|
|
||||||
movb (%edx),%al // lookup for light
|
|
||||||
movb %al,0(%ecx) // write it
|
|
||||||
jmp rdc8pdone // done!
|
|
||||||
.align 4, 0x90
|
|
||||||
rdc8pmany: // draw >1 pixel
|
|
||||||
movl _dc_x,%edx
|
|
||||||
movl _columnofs, %edi
|
|
||||||
movl (%edi,%edx,4),%edx
|
|
||||||
leal 0x12345678(%edx, %ecx), %edi // edi = two pixels above bottom
|
|
||||||
.globl rdc8pwidth5
|
|
||||||
rdc8pwidth5: // DeadBeef = -2*SCREENWIDTH
|
|
||||||
movl _dc_iscale,%edx // edx = fracstep
|
|
||||||
imull %edx,%eax
|
|
||||||
shll $9, %edx // fixme: Should get 7.25 fix as input
|
|
||||||
movl _dc_texturemid,%ecx
|
|
||||||
addl %eax,%ecx // ecx = frac
|
|
||||||
movl _dc_colormap,%eax // eax = lighting/special effects LUT
|
|
||||||
shll $9, %ecx
|
|
||||||
movl _dc_source,%esi // esi = source ptr
|
|
||||||
|
|
||||||
imull $0x12345678, %ebx // ebx = negative offset to pixel
|
|
||||||
.globl rdc8pwidth6
|
|
||||||
rdc8pwidth6: // DeadBeef = -SCREENWIDTH
|
|
||||||
|
|
||||||
// Begin the calculation of the two first pixels
|
|
||||||
leal (%ecx, %edx), %ebp
|
|
||||||
shrl $25, %ecx
|
|
||||||
movb (%esi, %ecx), %al
|
|
||||||
leal (%edx, %ebp), %ecx
|
|
||||||
shrl $25, %ebp
|
|
||||||
movb (%eax), %dl
|
|
||||||
|
|
||||||
// The main loop
|
|
||||||
rdc8ploop:
|
|
||||||
movb (%esi,%ebp), %al // load 1
|
|
||||||
leal (%ecx, %edx), %ebp // calc frac 3
|
|
||||||
|
|
||||||
shrl $25, %ecx // shift frac 2
|
|
||||||
movb %dl, 0x12345678(%edi, %ebx)// store 0
|
|
||||||
.globl rdc8pwidth1
|
|
||||||
rdc8pwidth1: // DeadBeef = 2*SCREENWIDTH
|
|
||||||
|
|
||||||
movb (%eax), %al // lookup 1
|
|
||||||
|
|
||||||
movb %al, 0x12345678(%edi, %ebx)// store 1
|
|
||||||
.globl rdc8pwidth2
|
|
||||||
rdc8pwidth2: // DeadBeef = 3*SCREENWIDTH
|
|
||||||
movb (%esi, %ecx), %al // load 2
|
|
||||||
|
|
||||||
leal (%ebp, %edx), %ecx // calc frac 4
|
|
||||||
|
|
||||||
shrl $25, %ebp // shift frac 3
|
|
||||||
movb (%eax), %dl // lookup 2
|
|
||||||
|
|
||||||
addl $0x12345678, %ebx // counter
|
|
||||||
.globl rdc8pwidth3
|
|
||||||
rdc8pwidth3: // DeadBeef = 2*SCREENWIDTH
|
|
||||||
jl rdc8ploop // loop
|
|
||||||
|
|
||||||
// End of loop. Write extra pixel or just exit.
|
|
||||||
jnz rdc8pdone
|
|
||||||
movb %dl, 0x12345678(%edi, %ebx)// Write odd pixel
|
|
||||||
.globl rdc8pwidth4
|
|
||||||
rdc8pwidth4: // DeadBeef = 2*SCREENWIDTH
|
|
||||||
|
|
||||||
rdc8pdone:
|
|
||||||
|
|
||||||
popl %edi
|
|
||||||
popl %esi
|
|
||||||
popl %ebx
|
|
||||||
popl %ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
//
|
|
||||||
// MMX asm version, optimised for K6
|
|
||||||
// By ES 1998/07/05
|
|
||||||
//
|
|
||||||
|
|
||||||
.globl _R_DrawColumn_8_K6_MMX
|
|
||||||
_R_DrawColumn_8_K6_MMX:
|
|
||||||
pushl %ebp
|
|
||||||
pushl %ebx
|
|
||||||
pushl %esi
|
|
||||||
pushl %edi
|
|
||||||
|
|
||||||
movl %esp, %eax // Push 8 or 12, so that (%esp) gets aligned by 8
|
|
||||||
andl $7,%eax
|
|
||||||
addl $8,%eax
|
|
||||||
movl %eax, _mmxcomm // Temp storage in mmxcomm: (%esp) is used instead
|
|
||||||
subl %eax,%esp
|
|
||||||
|
|
||||||
movl _dc_yl,%edx // Top pixel
|
|
||||||
movl _dc_yh,%ebx // Bottom pixel
|
|
||||||
movl _ylookup, %edi
|
|
||||||
movl (%edi,%ebx,4),%ecx
|
|
||||||
subl %edx,%ebx // ebx=number of pixels-1
|
|
||||||
jl 0x12345678 // no pixel to draw, done
|
|
||||||
.globl rdc8moffs1
|
|
||||||
rdc8moffs1:
|
|
||||||
jnz rdc8mmany
|
|
||||||
movl _dc_x,%eax // Special case: only one pixel
|
|
||||||
movl _columnofs, %edi
|
|
||||||
addl (%edi,%eax,4),%ecx // dest pixel at (%ecx)
|
|
||||||
movl _dc_iscale,%esi
|
|
||||||
imull %esi,%edx
|
|
||||||
movl _dc_texturemid,%edi
|
|
||||||
addl %edx,%edi // texture index in edi
|
|
||||||
movl _dc_colormap,%edx
|
|
||||||
shrl $16, %edi
|
|
||||||
movl _dc_source,%ebp
|
|
||||||
andl $127,%edi
|
|
||||||
movb (%edi,%ebp),%dl // read texture pixel
|
|
||||||
movb (%edx),%al // lookup for light
|
|
||||||
movb %al,0(%ecx) // write it
|
|
||||||
jmp rdc8mdone // done!
|
|
||||||
.globl rdc8moffs2
|
|
||||||
rdc8moffs2:
|
|
||||||
.align 4, 0x90
|
|
||||||
rdc8mmany: // draw >1 pixel
|
|
||||||
movl _dc_x,%eax
|
|
||||||
movl _columnofs, %edi
|
|
||||||
movl (%edi,%eax,4),%eax
|
|
||||||
leal 0x12345678(%eax, %ecx), %esi // esi = two pixels above bottom
|
|
||||||
.globl rdc8mwidth3
|
|
||||||
rdc8mwidth3: // DeadBeef = -2*SCREENWIDTH
|
|
||||||
movl _dc_iscale,%ecx // ecx = fracstep
|
|
||||||
imull %ecx,%edx
|
|
||||||
shll $9, %ecx // fixme: Should get 7.25 fix as input
|
|
||||||
movl _dc_texturemid,%eax
|
|
||||||
addl %edx,%eax // eax = frac
|
|
||||||
movl _dc_colormap,%edx // edx = lighting/special effects LUT
|
|
||||||
shll $9, %eax
|
|
||||||
leal (%ecx, %ecx), %edi
|
|
||||||
movl _dc_source,%ebp // ebp = source ptr
|
|
||||||
movl %edi, 0(%esp) // Start moving frac and fracstep to MMX regs
|
|
||||||
|
|
||||||
imull $0x12345678, %ebx // ebx = negative offset to pixel
|
|
||||||
.globl rdc8mwidth5
|
|
||||||
rdc8mwidth5: // DeadBeef = -SCREENWIDTH
|
|
||||||
|
|
||||||
movl %edi, 4(%esp)
|
|
||||||
leal (%eax, %ecx), %edi
|
|
||||||
movq 0(%esp), %mm1 // fracstep:fracstep in mm1
|
|
||||||
movl %eax, 0(%esp)
|
|
||||||
shrl $25, %eax
|
|
||||||
movl %edi, 4(%esp)
|
|
||||||
movzbl (%ebp, %eax), %eax
|
|
||||||
movq 0(%esp), %mm0 // frac:frac in mm0
|
|
||||||
|
|
||||||
paddd %mm1, %mm0
|
|
||||||
shrl $25, %edi
|
|
||||||
movq %mm0, %mm2
|
|
||||||
psrld $25, %mm2 // texture index in mm2
|
|
||||||
paddd %mm1, %mm0
|
|
||||||
movq %mm2, 0(%esp)
|
|
||||||
|
|
||||||
.globl rdc8mloop
|
|
||||||
rdc8mloop: // The main loop
|
|
||||||
movq %mm0, %mm2 // move 4-5 to temp reg
|
|
||||||
movzbl (%ebp, %edi), %edi // read 1
|
|
||||||
|
|
||||||
psrld $25, %mm2 // shift 4-5
|
|
||||||
movb (%edx,%eax), %cl // lookup 0
|
|
||||||
|
|
||||||
movl 0(%esp), %eax // load 2
|
|
||||||
addl $0x12345678, %ebx // counter
|
|
||||||
.globl rdc8mwidth2
|
|
||||||
rdc8mwidth2: // DeadBeef = 2*SCREENWIDTH
|
|
||||||
|
|
||||||
movb %cl, (%esi, %ebx) // write 0
|
|
||||||
movb (%edx,%edi), %ch // lookup 1
|
|
||||||
|
|
||||||
movb %ch, 0x12345678(%esi, %ebx) // write 1
|
|
||||||
.globl rdc8mwidth1
|
|
||||||
rdc8mwidth1: // DeadBeef = SCREENWIDTH
|
|
||||||
movl 4(%esp), %edi // load 3
|
|
||||||
|
|
||||||
paddd %mm1, %mm0 // frac 6-7
|
|
||||||
movzbl (%ebp, %eax), %eax // lookup 2
|
|
||||||
|
|
||||||
movq %mm2, 0(%esp) // store texture index 4-5
|
|
||||||
jl rdc8mloop
|
|
||||||
|
|
||||||
jnz rdc8mno_odd
|
|
||||||
movb (%edx,%eax), %cl // write the last odd pixel
|
|
||||||
movb %cl, 0x12345678(%esi)
|
|
||||||
.globl rdc8mwidth4
|
|
||||||
rdc8mwidth4: // DeadBeef = 2*SCREENWIDTH
|
|
||||||
rdc8mno_odd:
|
|
||||||
|
|
||||||
.globl rdc8mdone
|
|
||||||
rdc8mdone:
|
|
||||||
emms
|
|
||||||
|
|
||||||
addl _mmxcomm, %esp
|
|
||||||
popl %edi
|
|
||||||
popl %esi
|
|
||||||
popl %ebx
|
|
||||||
popl %ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
// Need some extra space to align run-time
|
|
||||||
.globl R_DrawColumn_8_K6_MMX_end
|
|
||||||
R_DrawColumn_8_K6_MMX_end:
|
|
||||||
nop;nop;nop;nop;nop;nop;nop;nop;
|
|
||||||
nop;nop;nop;nop;nop;nop;nop;nop;
|
|
||||||
nop;nop;nop;nop;nop;nop;nop;nop;
|
|
||||||
nop;nop;nop;nop;nop;nop;nop;
|
|
674
src/tmap_mmx.nas
674
src/tmap_mmx.nas
|
@ -1,674 +0,0 @@
|
||||||
;; SONIC ROBO BLAST 2
|
|
||||||
;;-----------------------------------------------------------------------------
|
|
||||||
;; Copyright (C) 1998-2000 by DOSDOOM.
|
|
||||||
;; Copyright (C) 2010-2023 by Sonic Team Junior.
|
|
||||||
;;
|
|
||||||
;; This program is free software distributed under the
|
|
||||||
;; terms of the GNU General Public License, version 2.
|
|
||||||
;; See the 'LICENSE' file for more details.
|
|
||||||
;;-----------------------------------------------------------------------------
|
|
||||||
;; FILE:
|
|
||||||
;; tmap_mmx.nas
|
|
||||||
;; DESCRIPTION:
|
|
||||||
;; Assembler optimised rendering code for software mode, using SIMD
|
|
||||||
;; instructions.
|
|
||||||
;; Draw wall columns.
|
|
||||||
|
|
||||||
|
|
||||||
[BITS 32]
|
|
||||||
|
|
||||||
%define FRACBITS 16
|
|
||||||
%define TRANSPARENTPIXEL 255
|
|
||||||
|
|
||||||
%ifdef LINUX
|
|
||||||
%macro cextern 1
|
|
||||||
[extern %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
%macro cglobal 1
|
|
||||||
[global %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
%else
|
|
||||||
%macro cextern 1
|
|
||||||
%define %1 _%1
|
|
||||||
[extern %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
%macro cglobal 1
|
|
||||||
%define %1 _%1
|
|
||||||
[global %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
; The viddef_s structure. We only need the width field.
|
|
||||||
struc viddef_s
|
|
||||||
resb 12
|
|
||||||
.width: resb 4
|
|
||||||
resb 44
|
|
||||||
endstruc
|
|
||||||
|
|
||||||
|
|
||||||
;; externs
|
|
||||||
;; columns
|
|
||||||
cextern dc_colormap
|
|
||||||
cextern dc_x
|
|
||||||
cextern dc_yl
|
|
||||||
cextern dc_yh
|
|
||||||
cextern dc_iscale
|
|
||||||
cextern dc_texturemid
|
|
||||||
cextern dc_texheight
|
|
||||||
cextern dc_source
|
|
||||||
cextern dc_hires
|
|
||||||
cextern centery
|
|
||||||
cextern centeryfrac
|
|
||||||
cextern dc_transmap
|
|
||||||
|
|
||||||
cextern R_DrawColumn_8_ASM
|
|
||||||
cextern R_Draw2sMultiPatchColumn_8_ASM
|
|
||||||
|
|
||||||
;; spans
|
|
||||||
cextern nflatshiftup
|
|
||||||
cextern nflatxshift
|
|
||||||
cextern nflatyshift
|
|
||||||
cextern nflatmask
|
|
||||||
cextern ds_xfrac
|
|
||||||
cextern ds_yfrac
|
|
||||||
cextern ds_xstep
|
|
||||||
cextern ds_ystep
|
|
||||||
cextern ds_x1
|
|
||||||
cextern ds_x2
|
|
||||||
cextern ds_y
|
|
||||||
cextern ds_source
|
|
||||||
cextern ds_colormap
|
|
||||||
|
|
||||||
cextern ylookup
|
|
||||||
cextern columnofs
|
|
||||||
cextern vid
|
|
||||||
|
|
||||||
[SECTION .data]
|
|
||||||
|
|
||||||
nflatmask64 dq 0
|
|
||||||
|
|
||||||
|
|
||||||
[SECTION .text]
|
|
||||||
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;;
|
|
||||||
;; R_DrawColumn : 8bpp column drawer
|
|
||||||
;;
|
|
||||||
;; MMX column drawer.
|
|
||||||
;;
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;; eax = accumulator
|
|
||||||
;; ebx = colormap
|
|
||||||
;; ecx = count
|
|
||||||
;; edx = accumulator
|
|
||||||
;; esi = source
|
|
||||||
;; edi = dest
|
|
||||||
;; ebp = vid.width
|
|
||||||
;; mm0 = accumulator
|
|
||||||
;; mm1 = heightmask, twice
|
|
||||||
;; mm2 = 2 * fracstep, twice
|
|
||||||
;; mm3 = pair of consecutive fracs
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
cglobal R_DrawColumn_8_MMX
|
|
||||||
R_DrawColumn_8_MMX:
|
|
||||||
push ebp ;; preserve caller's stack frame pointer
|
|
||||||
push esi ;; preserve register variables
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Our algorithm requires that the texture height be a power of two.
|
|
||||||
;; If not, fall back to the non-MMX drawer.
|
|
||||||
;;
|
|
||||||
.texheightcheck:
|
|
||||||
mov edx, [dc_texheight]
|
|
||||||
sub edx, 1 ;; edx = heightmask
|
|
||||||
test edx, [dc_texheight]
|
|
||||||
jnz near .usenonMMX
|
|
||||||
|
|
||||||
mov ebp, edx ;; Keep a copy of heightmask in a
|
|
||||||
;; GPR for the time being.
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Fill mm1 with heightmask
|
|
||||||
;;
|
|
||||||
movd mm1, edx ;; low dword = heightmask
|
|
||||||
punpckldq mm1, mm1 ;; copy low dword to high dword
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; dest = ylookup[dc_yl] + columnofs[dc_x];
|
|
||||||
;;
|
|
||||||
mov eax, [dc_yl]
|
|
||||||
mov edi, [ylookup+eax*4]
|
|
||||||
mov ebx, [dc_x]
|
|
||||||
add edi, [columnofs+ebx*4] ;; edi = dest
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; pixelcount = yh - yl + 1
|
|
||||||
;;
|
|
||||||
mov ecx, [dc_yh]
|
|
||||||
add ecx, 1
|
|
||||||
sub ecx, eax ;; pixel count
|
|
||||||
jle near .done ;; nothing to scale
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; fracstep = dc_iscale;
|
|
||||||
;;
|
|
||||||
movd mm2, [dc_iscale] ;; fracstep in low dword
|
|
||||||
punpckldq mm2, mm2 ;; copy to high dword
|
|
||||||
|
|
||||||
mov ebx, [dc_colormap]
|
|
||||||
mov esi, [dc_source]
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
|
|
||||||
;;
|
|
||||||
;; eax == dc_yl already
|
|
||||||
shl eax, FRACBITS
|
|
||||||
sub eax, [centeryfrac]
|
|
||||||
imul dword [dc_iscale]
|
|
||||||
shrd eax, edx, FRACBITS
|
|
||||||
add eax, [dc_texturemid]
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; if (dc_hires) frac = 0;
|
|
||||||
;;
|
|
||||||
test byte [dc_hires], 0x01
|
|
||||||
jz .mod2
|
|
||||||
xor eax, eax
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Do mod-2 pixel.
|
|
||||||
;;
|
|
||||||
.mod2:
|
|
||||||
test ecx, 1
|
|
||||||
jz .pairprepare
|
|
||||||
mov edx, eax ;; edx = frac
|
|
||||||
add eax, [dc_iscale] ;; eax += fracstep
|
|
||||||
sar edx, FRACBITS
|
|
||||||
and edx, ebp ;; edx &= heightmask
|
|
||||||
movzx edx, byte [esi + edx]
|
|
||||||
movzx edx, byte [ebx + edx]
|
|
||||||
mov [edi], dl
|
|
||||||
|
|
||||||
add edi, [vid + viddef_s.width]
|
|
||||||
sub ecx, 1
|
|
||||||
jz .done
|
|
||||||
|
|
||||||
.pairprepare:
|
|
||||||
;;
|
|
||||||
;; Prepare for the main loop.
|
|
||||||
;;
|
|
||||||
movd mm3, eax ;; Low dword = frac
|
|
||||||
movq mm4, mm3 ;; Copy to intermediate register
|
|
||||||
paddd mm4, mm2 ;; dwords of mm4 += fracstep
|
|
||||||
punpckldq mm3, mm4 ;; Low dword = first frac, high = second
|
|
||||||
pslld mm2, 1 ;; fracstep *= 2
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; ebp = vid.width
|
|
||||||
;;
|
|
||||||
mov ebp, [vid + viddef_s.width]
|
|
||||||
|
|
||||||
align 16
|
|
||||||
.pairloop:
|
|
||||||
movq mm0, mm3 ;; 3B 1u.
|
|
||||||
psrad mm0, FRACBITS ;; 4B 1u.
|
|
||||||
pand mm0, mm1 ;; 3B 1u. frac &= heightmask
|
|
||||||
paddd mm3, mm2 ;; 3B 1u. frac += fracstep
|
|
||||||
|
|
||||||
movd eax, mm0 ;; 3B 1u. Get first frac
|
|
||||||
;; IFETCH boundary
|
|
||||||
movzx eax, byte [esi + eax] ;; 4B 1u. Texture map
|
|
||||||
movzx eax, byte [ebx + eax] ;; 4B 1u. Colormap
|
|
||||||
|
|
||||||
punpckhdq mm0, mm0 ;; 3B 1(2)u. low dword = high dword
|
|
||||||
movd edx, mm0 ;; 3B 1u. Get second frac
|
|
||||||
mov [edi], al ;; 2B 1(2)u. First pixel
|
|
||||||
;; IFETCH boundary
|
|
||||||
|
|
||||||
movzx edx, byte [esi + edx] ;; 4B 1u. Texture map
|
|
||||||
movzx edx, byte [ebx + edx] ;; 4B 1u. Colormap
|
|
||||||
mov [edi + 1*ebp], dl ;; 3B 1(2)u. Second pixel
|
|
||||||
|
|
||||||
lea edi, [edi + 2*ebp] ;; 3B 1u. edi += 2 * vid.width
|
|
||||||
;; IFETCH boundary
|
|
||||||
sub ecx, 2 ;; 3B 1u. count -= 2
|
|
||||||
jnz .pairloop ;; 2B 1u. if(count != 0) goto .pairloop
|
|
||||||
|
|
||||||
|
|
||||||
.done:
|
|
||||||
;;
|
|
||||||
;; Clear MMX state, or else FPU operations will go badly awry.
|
|
||||||
;;
|
|
||||||
emms
|
|
||||||
|
|
||||||
pop ebx
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
.usenonMMX:
|
|
||||||
call R_DrawColumn_8_ASM
|
|
||||||
jmp .done
|
|
||||||
|
|
||||||
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;;
|
|
||||||
;; R_Draw2sMultiPatchColumn : Like R_DrawColumn, but omits transparent
|
|
||||||
;; pixels.
|
|
||||||
;;
|
|
||||||
;; MMX column drawer.
|
|
||||||
;;
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;; eax = accumulator
|
|
||||||
;; ebx = colormap
|
|
||||||
;; ecx = count
|
|
||||||
;; edx = accumulator
|
|
||||||
;; esi = source
|
|
||||||
;; edi = dest
|
|
||||||
;; ebp = vid.width
|
|
||||||
;; mm0 = accumulator
|
|
||||||
;; mm1 = heightmask, twice
|
|
||||||
;; mm2 = 2 * fracstep, twice
|
|
||||||
;; mm3 = pair of consecutive fracs
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
cglobal R_Draw2sMultiPatchColumn_8_MMX
|
|
||||||
R_Draw2sMultiPatchColumn_8_MMX:
|
|
||||||
push ebp ;; preserve caller's stack frame pointer
|
|
||||||
push esi ;; preserve register variables
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Our algorithm requires that the texture height be a power of two.
|
|
||||||
;; If not, fall back to the non-MMX drawer.
|
|
||||||
;;
|
|
||||||
.texheightcheck:
|
|
||||||
mov edx, [dc_texheight]
|
|
||||||
sub edx, 1 ;; edx = heightmask
|
|
||||||
test edx, [dc_texheight]
|
|
||||||
jnz near .usenonMMX
|
|
||||||
|
|
||||||
mov ebp, edx ;; Keep a copy of heightmask in a
|
|
||||||
;; GPR for the time being.
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Fill mm1 with heightmask
|
|
||||||
;;
|
|
||||||
movd mm1, edx ;; low dword = heightmask
|
|
||||||
punpckldq mm1, mm1 ;; copy low dword to high dword
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; dest = ylookup[dc_yl] + columnofs[dc_x];
|
|
||||||
;;
|
|
||||||
mov eax, [dc_yl]
|
|
||||||
mov edi, [ylookup+eax*4]
|
|
||||||
mov ebx, [dc_x]
|
|
||||||
add edi, [columnofs+ebx*4] ;; edi = dest
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; pixelcount = yh - yl + 1
|
|
||||||
;;
|
|
||||||
mov ecx, [dc_yh]
|
|
||||||
add ecx, 1
|
|
||||||
sub ecx, eax ;; pixel count
|
|
||||||
jle near .done ;; nothing to scale
|
|
||||||
;;
|
|
||||||
;; fracstep = dc_iscale;
|
|
||||||
;;
|
|
||||||
movd mm2, [dc_iscale] ;; fracstep in low dword
|
|
||||||
punpckldq mm2, mm2 ;; copy to high dword
|
|
||||||
|
|
||||||
mov ebx, [dc_colormap]
|
|
||||||
mov esi, [dc_source]
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
|
|
||||||
;;
|
|
||||||
;; eax == dc_yl already
|
|
||||||
shl eax, FRACBITS
|
|
||||||
sub eax, [centeryfrac]
|
|
||||||
imul dword [dc_iscale]
|
|
||||||
shrd eax, edx, FRACBITS
|
|
||||||
add eax, [dc_texturemid]
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; if (dc_hires) frac = 0;
|
|
||||||
;;
|
|
||||||
test byte [dc_hires], 0x01
|
|
||||||
jz .mod2
|
|
||||||
xor eax, eax
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Do mod-2 pixel.
|
|
||||||
;;
|
|
||||||
.mod2:
|
|
||||||
test ecx, 1
|
|
||||||
jz .pairprepare
|
|
||||||
mov edx, eax ;; edx = frac
|
|
||||||
add eax, [dc_iscale] ;; eax += fracstep
|
|
||||||
sar edx, FRACBITS
|
|
||||||
and edx, ebp ;; edx &= heightmask
|
|
||||||
movzx edx, byte [esi + edx]
|
|
||||||
cmp dl, TRANSPARENTPIXEL
|
|
||||||
je .nextmod2
|
|
||||||
movzx edx, byte [ebx + edx]
|
|
||||||
mov [edi], dl
|
|
||||||
|
|
||||||
.nextmod2:
|
|
||||||
add edi, [vid + viddef_s.width]
|
|
||||||
sub ecx, 1
|
|
||||||
jz .done
|
|
||||||
|
|
||||||
.pairprepare:
|
|
||||||
;;
|
|
||||||
;; Prepare for the main loop.
|
|
||||||
;;
|
|
||||||
movd mm3, eax ;; Low dword = frac
|
|
||||||
movq mm4, mm3 ;; Copy to intermediate register
|
|
||||||
paddd mm4, mm2 ;; dwords of mm4 += fracstep
|
|
||||||
punpckldq mm3, mm4 ;; Low dword = first frac, high = second
|
|
||||||
pslld mm2, 1 ;; fracstep *= 2
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; ebp = vid.width
|
|
||||||
;;
|
|
||||||
mov ebp, [vid + viddef_s.width]
|
|
||||||
|
|
||||||
align 16
|
|
||||||
.pairloop:
|
|
||||||
movq mm0, mm3 ;; 3B 1u.
|
|
||||||
psrad mm0, FRACBITS ;; 4B 1u.
|
|
||||||
pand mm0, mm1 ;; 3B 1u. frac &= heightmask
|
|
||||||
paddd mm3, mm2 ;; 3B 1u. frac += fracstep
|
|
||||||
|
|
||||||
movd eax, mm0 ;; 3B 1u. Get first frac
|
|
||||||
;; IFETCH boundary
|
|
||||||
movzx eax, byte [esi + eax] ;; 4B 1u. Texture map
|
|
||||||
punpckhdq mm0, mm0 ;; 3B 1(2)u. low dword = high dword
|
|
||||||
movd edx, mm0 ;; 3B 1u. Get second frac
|
|
||||||
cmp al, TRANSPARENTPIXEL ;; 2B 1u.
|
|
||||||
je .secondinpair ;; 2B 1u.
|
|
||||||
;; IFETCH boundary
|
|
||||||
movzx eax, byte [ebx + eax] ;; 4B 1u. Colormap
|
|
||||||
mov [edi], al ;; 2B 1(2)u. First pixel
|
|
||||||
|
|
||||||
.secondinpair:
|
|
||||||
movzx edx, byte [esi + edx] ;; 4B 1u. Texture map
|
|
||||||
cmp dl, TRANSPARENTPIXEL ;; 2B 1u.
|
|
||||||
je .nextpair ;; 2B 1u.
|
|
||||||
;; IFETCH boundary
|
|
||||||
movzx edx, byte [ebx + edx] ;; 4B 1u. Colormap
|
|
||||||
mov [edi + 1*ebp], dl ;; 3B 1(2)u. Second pixel
|
|
||||||
|
|
||||||
.nextpair:
|
|
||||||
lea edi, [edi + 2*ebp] ;; 3B 1u. edi += 2 * vid.width
|
|
||||||
sub ecx, 2 ;; 3B 1u. count -= 2
|
|
||||||
jnz .pairloop ;; 2B 1u. if(count != 0) goto .pairloop
|
|
||||||
|
|
||||||
|
|
||||||
.done:
|
|
||||||
;;
|
|
||||||
;; Clear MMX state, or else FPU operations will go badly awry.
|
|
||||||
;;
|
|
||||||
emms
|
|
||||||
|
|
||||||
pop ebx
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
.usenonMMX:
|
|
||||||
call R_Draw2sMultiPatchColumn_8_ASM
|
|
||||||
jmp .done
|
|
||||||
|
|
||||||
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;;
|
|
||||||
;; R_DrawSpan : 8bpp span drawer
|
|
||||||
;;
|
|
||||||
;; MMX span drawer.
|
|
||||||
;;
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
;; eax = accumulator
|
|
||||||
;; ebx = colormap
|
|
||||||
;; ecx = count
|
|
||||||
;; edx = accumulator
|
|
||||||
;; esi = source
|
|
||||||
;; edi = dest
|
|
||||||
;; ebp = two pixels
|
|
||||||
;; mm0 = accumulator
|
|
||||||
;; mm1 = xposition
|
|
||||||
;; mm2 = yposition
|
|
||||||
;; mm3 = 2 * xstep
|
|
||||||
;; mm4 = 2 * ystep
|
|
||||||
;; mm5 = nflatxshift
|
|
||||||
;; mm6 = nflatyshift
|
|
||||||
;; mm7 = accumulator
|
|
||||||
;;----------------------------------------------------------------------
|
|
||||||
|
|
||||||
cglobal R_DrawSpan_8_MMX
|
|
||||||
R_DrawSpan_8_MMX:
|
|
||||||
push ebp ;; preserve caller's stack frame pointer
|
|
||||||
push esi ;; preserve register variables
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; esi = ds_source
|
|
||||||
;; ebx = ds_colormap
|
|
||||||
;;
|
|
||||||
mov esi, [ds_source]
|
|
||||||
mov ebx, [ds_colormap]
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; edi = ylookup[ds_y] + columnofs[ds_x1]
|
|
||||||
;;
|
|
||||||
mov eax, [ds_y]
|
|
||||||
mov edi, [ylookup + eax*4]
|
|
||||||
mov edx, [ds_x1]
|
|
||||||
add edi, [columnofs + edx*4]
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; ecx = ds_x2 - ds_x1 + 1
|
|
||||||
;;
|
|
||||||
mov ecx, [ds_x2]
|
|
||||||
sub ecx, edx
|
|
||||||
add ecx, 1
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Needed for fracs and steps
|
|
||||||
;;
|
|
||||||
movd mm7, [nflatshiftup]
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; mm3 = xstep
|
|
||||||
;;
|
|
||||||
movd mm3, [ds_xstep]
|
|
||||||
pslld mm3, mm7
|
|
||||||
punpckldq mm3, mm3
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; mm4 = ystep
|
|
||||||
;;
|
|
||||||
movd mm4, [ds_ystep]
|
|
||||||
pslld mm4, mm7
|
|
||||||
punpckldq mm4, mm4
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; mm1 = pair of consecutive xpositions
|
|
||||||
;;
|
|
||||||
movd mm1, [ds_xfrac]
|
|
||||||
pslld mm1, mm7
|
|
||||||
movq mm6, mm1
|
|
||||||
paddd mm6, mm3
|
|
||||||
punpckldq mm1, mm6
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; mm2 = pair of consecutive ypositions
|
|
||||||
;;
|
|
||||||
movd mm2, [ds_yfrac]
|
|
||||||
pslld mm2, mm7
|
|
||||||
movq mm6, mm2
|
|
||||||
paddd mm6, mm4
|
|
||||||
punpckldq mm2, mm6
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; mm5 = nflatxshift
|
|
||||||
;; mm6 = nflatyshift
|
|
||||||
;;
|
|
||||||
movd mm5, [nflatxshift]
|
|
||||||
movd mm6, [nflatyshift]
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Mask is in memory due to lack of registers.
|
|
||||||
;;
|
|
||||||
mov eax, [nflatmask]
|
|
||||||
mov [nflatmask64], eax
|
|
||||||
mov [nflatmask64 + 4], eax
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Go until we reach a dword boundary.
|
|
||||||
;;
|
|
||||||
.unaligned:
|
|
||||||
test edi, 3
|
|
||||||
jz .alignedprep
|
|
||||||
.stragglers:
|
|
||||||
cmp ecx, 0
|
|
||||||
je .done ;; If ecx == 0, we're finished.
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; eax = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)
|
|
||||||
;;
|
|
||||||
movq mm0, mm1 ;; mm0 = xposition
|
|
||||||
movq mm7, mm2 ;; mm7 = yposition
|
|
||||||
paddd mm1, mm3 ;; xposition += xstep (once!)
|
|
||||||
paddd mm2, mm4 ;; yposition += ystep (once!)
|
|
||||||
psrld mm0, mm5 ;; shift
|
|
||||||
psrld mm7, mm6 ;; shift
|
|
||||||
pand mm7, [nflatmask64] ;; mask
|
|
||||||
por mm0, mm7 ;; or x and y together
|
|
||||||
|
|
||||||
movd eax, mm0 ;; eax = index of first pixel
|
|
||||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
|
||||||
movzx eax, byte [ebx + eax] ;; al = colormap[al]
|
|
||||||
|
|
||||||
mov [edi], al
|
|
||||||
add edi, 1
|
|
||||||
|
|
||||||
sub ecx, 1
|
|
||||||
jmp .unaligned
|
|
||||||
|
|
||||||
|
|
||||||
.alignedprep:
|
|
||||||
;;
|
|
||||||
;; We can double the steps now.
|
|
||||||
;;
|
|
||||||
pslld mm3, 1
|
|
||||||
pslld mm4, 1
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Generate chunks of four pixels.
|
|
||||||
;;
|
|
||||||
.alignedloop:
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Make sure we have at least four pixels.
|
|
||||||
;;
|
|
||||||
cmp ecx, 4
|
|
||||||
jl .prestragglers
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; First two pixels.
|
|
||||||
;;
|
|
||||||
movq mm0, mm1 ;; mm0 = xposition
|
|
||||||
movq mm7, mm2 ;; mm7 = yposition
|
|
||||||
paddd mm1, mm3 ;; xposition += xstep
|
|
||||||
paddd mm2, mm4 ;; yposition += ystep
|
|
||||||
psrld mm0, mm5 ;; shift
|
|
||||||
psrld mm7, mm6 ;; shift
|
|
||||||
pand mm7, [nflatmask64] ;; mask
|
|
||||||
por mm0, mm7 ;; or x and y together
|
|
||||||
|
|
||||||
movd eax, mm0 ;; eax = index of first pixel
|
|
||||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
|
||||||
movzx ebp, byte [ebx + eax] ;; ebp = colormap[al]
|
|
||||||
|
|
||||||
punpckhdq mm0, mm0 ;; both dwords = high dword
|
|
||||||
movd eax, mm0 ;; eax = index of second pixel
|
|
||||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
|
||||||
movzx eax, byte [ebx + eax] ;; al = colormap[al]
|
|
||||||
shl eax, 8 ;; get pixel in right byte
|
|
||||||
or ebp, eax ;; put pixel in ebp
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Next two pixels.
|
|
||||||
;;
|
|
||||||
movq mm0, mm1 ;; mm0 = xposition
|
|
||||||
movq mm7, mm2 ;; mm7 = yposition
|
|
||||||
paddd mm1, mm3 ;; xposition += xstep
|
|
||||||
paddd mm2, mm4 ;; yposition += ystep
|
|
||||||
psrld mm0, mm5 ;; shift
|
|
||||||
psrld mm7, mm6 ;; shift
|
|
||||||
pand mm7, [nflatmask64] ;; mask
|
|
||||||
por mm0, mm7 ;; or x and y together
|
|
||||||
|
|
||||||
movd eax, mm0 ;; eax = index of third pixel
|
|
||||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
|
||||||
movzx eax, byte [ebx + eax] ;; al = colormap[al]
|
|
||||||
shl eax, 16 ;; get pixel in right byte
|
|
||||||
or ebp, eax ;; put pixel in ebp
|
|
||||||
|
|
||||||
punpckhdq mm0, mm0 ;; both dwords = high dword
|
|
||||||
movd eax, mm0 ;; eax = index of second pixel
|
|
||||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
|
||||||
movzx eax, byte [ebx + eax] ;; al = colormap[al]
|
|
||||||
shl eax, 24 ;; get pixel in right byte
|
|
||||||
or ebp, eax ;; put pixel in ebp
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Write pixels.
|
|
||||||
;;
|
|
||||||
mov [edi], ebp
|
|
||||||
add edi, 4
|
|
||||||
|
|
||||||
sub ecx, 4
|
|
||||||
jmp .alignedloop
|
|
||||||
|
|
||||||
.prestragglers:
|
|
||||||
;;
|
|
||||||
;; Back to one step at a time.
|
|
||||||
;;
|
|
||||||
psrad mm3, 1
|
|
||||||
psrad mm4, 1
|
|
||||||
jmp .stragglers
|
|
||||||
|
|
||||||
.done:
|
|
||||||
;;
|
|
||||||
;; Clear MMX state, or else FPU operations will go badly awry.
|
|
||||||
;;
|
|
||||||
emms
|
|
||||||
|
|
||||||
pop ebx
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebp
|
|
||||||
ret
|
|
|
@ -1,48 +0,0 @@
|
||||||
;; SONIC ROBO BLAST 2
|
|
||||||
;;-----------------------------------------------------------------------------
|
|
||||||
;; Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
;; Copyright (C) 1999-2023 by Sonic Team Junior.
|
|
||||||
;;
|
|
||||||
;; This program is free software distributed under the
|
|
||||||
;; terms of the GNU General Public License, version 2.
|
|
||||||
;; See the 'LICENSE' file for more details.
|
|
||||||
;;-----------------------------------------------------------------------------
|
|
||||||
;; FILE:
|
|
||||||
;; tmap_vc.nas
|
|
||||||
;; DESCRIPTION:
|
|
||||||
;; Assembler optimised math code for Visual C++.
|
|
||||||
|
|
||||||
|
|
||||||
[BITS 32]
|
|
||||||
|
|
||||||
%macro cglobal 1
|
|
||||||
%define %1 _%1
|
|
||||||
[global %1]
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
[SECTION .text write]
|
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
|
||||||
;fixed_t FixedMul (fixed_t a, fixed_t b)
|
|
||||||
;----------------------------------------------------------------------------
|
|
||||||
cglobal FixedMul
|
|
||||||
; align 16
|
|
||||||
FixedMul:
|
|
||||||
mov eax,[esp+4]
|
|
||||||
imul dword [esp+8]
|
|
||||||
shrd eax,edx,16
|
|
||||||
ret
|
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
|
||||||
;fixed_t FixedDiv2 (fixed_t a, fixed_t b);
|
|
||||||
;----------------------------------------------------------------------------
|
|
||||||
cglobal FixedDiv2
|
|
||||||
; align 16
|
|
||||||
FixedDiv2:
|
|
||||||
mov eax,[esp+4]
|
|
||||||
mov edx,eax ;; these two instructions allow the next
|
|
||||||
sar edx,31 ;; two to pair, on the Pentium processor.
|
|
||||||
shld edx,eax,16
|
|
||||||
sal eax,16
|
|
||||||
idiv dword [esp+8]
|
|
||||||
ret
|
|
|
@ -447,12 +447,6 @@ static void CV_palette_OnChange(void)
|
||||||
V_SetPalette(0);
|
V_SetPalette(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (__GNUC__) && defined (__i386__) && !defined (NOASM) && !defined (__APPLE__) && !defined (NORUSEASM)
|
|
||||||
void VID_BlitLinearScreen_ASM(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
|
||||||
size_t destrowbytes);
|
|
||||||
#define HAVE_VIDCOPY
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void CV_constextsize_OnChange(void)
|
static void CV_constextsize_OnChange(void)
|
||||||
{
|
{
|
||||||
if (!con_refresh)
|
if (!con_refresh)
|
||||||
|
@ -466,9 +460,6 @@ static void CV_constextsize_OnChange(void)
|
||||||
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
||||||
size_t destrowbytes)
|
size_t destrowbytes)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_VIDCOPY
|
|
||||||
VID_BlitLinearScreen_ASM(srcptr,destptr,width,height,srcrowbytes,destrowbytes);
|
|
||||||
#else
|
|
||||||
if (srcrowbytes == destrowbytes)
|
if (srcrowbytes == destrowbytes)
|
||||||
M_Memcpy(destptr, srcptr, srcrowbytes * height);
|
M_Memcpy(destptr, srcptr, srcrowbytes * height);
|
||||||
else
|
else
|
||||||
|
@ -481,7 +472,6 @@ void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT3
|
||||||
srcptr += srcrowbytes;
|
srcptr += srcrowbytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0};
|
static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
// Copyright (C) 1999-2023 by Sonic Team Junior.
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file vid_copy.s
|
|
||||||
/// \brief code for updating the linear frame buffer screen.
|
|
||||||
|
|
||||||
#include "asm_defs.inc" // structures, must match the C structures!
|
|
||||||
|
|
||||||
// DJGPPv2 is as fast as this one, but then someone may compile with a less
|
|
||||||
// good version of DJGPP than mine, so this little asm will do the trick!
|
|
||||||
|
|
||||||
#define srcptr 4+16
|
|
||||||
#define destptr 8+16
|
|
||||||
#define width 12+16
|
|
||||||
#define height 16+16
|
|
||||||
#define srcrowbytes 20+16
|
|
||||||
#define destrowbytes 24+16
|
|
||||||
|
|
||||||
// VID_BlitLinearScreen( src, dest, width, height, srcwidth, destwidth );
|
|
||||||
// width is given as BYTES
|
|
||||||
|
|
||||||
#ifdef __i386__
|
|
||||||
|
|
||||||
.globl C(VID_BlitLinearScreen_ASM)
|
|
||||||
C(VID_BlitLinearScreen_ASM):
|
|
||||||
pushl %ebp // preserve caller's stack frame
|
|
||||||
pushl %edi
|
|
||||||
pushl %esi // preserve register variables
|
|
||||||
pushl %ebx
|
|
||||||
|
|
||||||
cld
|
|
||||||
movl srcptr(%esp),%esi
|
|
||||||
movl destptr(%esp),%edi
|
|
||||||
movl width(%esp),%ebx
|
|
||||||
movl srcrowbytes(%esp),%eax
|
|
||||||
subl %ebx,%eax
|
|
||||||
movl destrowbytes(%esp),%edx
|
|
||||||
subl %ebx,%edx
|
|
||||||
shrl $2,%ebx
|
|
||||||
movl height(%esp),%ebp
|
|
||||||
LLRowLoop:
|
|
||||||
movl %ebx,%ecx
|
|
||||||
rep/movsl (%esi),(%edi)
|
|
||||||
addl %eax,%esi
|
|
||||||
addl %edx,%edi
|
|
||||||
decl %ebp
|
|
||||||
jnz LLRowLoop
|
|
||||||
|
|
||||||
popl %ebx // restore register variables
|
|
||||||
popl %esi
|
|
||||||
popl %edi
|
|
||||||
popl %ebp // restore the caller's stack frame
|
|
||||||
|
|
||||||
ret
|
|
||||||
#endif
|
|
|
@ -1150,6 +1150,7 @@ UINT16 W_InitFolder(const char *path, boolean mainfile, boolean startup)
|
||||||
Z_Calloc(numlumps * sizeof (*wadfile->patchcache), PU_STATIC, &wadfile->patchcache);
|
Z_Calloc(numlumps * sizeof (*wadfile->patchcache), PU_STATIC, &wadfile->patchcache);
|
||||||
|
|
||||||
CONS_Printf(M_GetText("Added folder %s (%u files, %u folders)\n"), fn, numlumps, foldercount);
|
CONS_Printf(M_GetText("Added folder %s (%u files, %u folders)\n"), fn, numlumps, foldercount);
|
||||||
|
wadfiles = Z_Realloc(wadfiles, sizeof(wadfile_t *) * (numwadfiles + 1), PU_STATIC, NULL);
|
||||||
wadfiles[numwadfiles] = wadfile;
|
wadfiles[numwadfiles] = wadfile;
|
||||||
numwadfiles++;
|
numwadfiles++;
|
||||||
|
|
||||||
|
|
|
@ -998,8 +998,7 @@ void Y_Ticker(void)
|
||||||
if (paused || P_AutoPause())
|
if (paused || P_AutoPause())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LUA_HookBool(intertype == int_spec && stagefailed,
|
LUA_HookBool(stagefailed, HOOK(IntermissionThinker));
|
||||||
HOOK(IntermissionThinker));
|
|
||||||
|
|
||||||
intertic++;
|
intertic++;
|
||||||
|
|
||||||
|
@ -2044,7 +2043,7 @@ static void Y_AwardCoopBonuses(void)
|
||||||
y_bonus_t localbonuses[4];
|
y_bonus_t localbonuses[4];
|
||||||
|
|
||||||
// set score/total first
|
// set score/total first
|
||||||
data.coop.total = 0;
|
data.coop.total = players[consoleplayer].recordscore;
|
||||||
data.coop.score = players[consoleplayer].score;
|
data.coop.score = players[consoleplayer].score;
|
||||||
data.coop.gotperfbonus = -1;
|
data.coop.gotperfbonus = -1;
|
||||||
memset(data.coop.bonuses, 0, sizeof(data.coop.bonuses));
|
memset(data.coop.bonuses, 0, sizeof(data.coop.bonuses));
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#define __Z_ZONE__
|
#define __Z_ZONE__
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "doomdef.h"
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
|
||||||
#ifdef __GNUC__ // __attribute__ ((X))
|
#ifdef __GNUC__ // __attribute__ ((X))
|
||||||
|
|
522
thirdparty/CMakeLists.txt
vendored
522
thirdparty/CMakeLists.txt
vendored
|
@ -9,521 +9,13 @@ else()
|
||||||
set(NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES ON)
|
set(NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
||||||
CPMAddPackage(
|
include("cpm-sdl2.cmake")
|
||||||
NAME SDL2
|
include("cpm-sdl2-mixer.cmake")
|
||||||
VERSION 2.24.2
|
include("cpm-zlib.cmake")
|
||||||
URL "https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.24.2.zip"
|
include("cpm-png.cmake")
|
||||||
EXCLUDE_FROM_ALL ON
|
include("cpm-curl.cmake")
|
||||||
OPTIONS
|
include("cpm-openmpt.cmake")
|
||||||
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
|
||||||
"SDL_SHARED ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
|
||||||
"SDL_STATIC ${NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
|
||||||
"SDL_TEST OFF"
|
|
||||||
"SDL2_DISABLE_SDL2MAIN ON"
|
|
||||||
"SDL2_DISABLE_INSTALL ON"
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
include("cpm-libgme.cmake")
|
||||||
CPMAddPackage(
|
|
||||||
NAME SDL2_mixer
|
|
||||||
VERSION 2.6.2
|
|
||||||
URL "https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/release-2.6.2.zip"
|
|
||||||
EXCLUDE_FROM_ALL ON
|
|
||||||
OPTIONS
|
|
||||||
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
|
||||||
"SDL2MIXER_INSTALL OFF"
|
|
||||||
"SDL2MIXER_DEPS_SHARED OFF"
|
|
||||||
"SDL2MIXER_SAMPLES OFF"
|
|
||||||
"SDL2MIXER_VENDORED ON"
|
|
||||||
"SDL2MIXER_FLAC ON"
|
|
||||||
"SDL2MIXER_FLAC_LIBFLAC OFF"
|
|
||||||
"SDL2MIXER_FLAC_DRFLAC ON"
|
|
||||||
"SDL2MIXER_MOD OFF"
|
|
||||||
"SDL2MIXER_MP3 ON"
|
|
||||||
"SDL2MIXER_MP3_DRMP3 ON"
|
|
||||||
"SDL2MIXER_MIDI ON"
|
|
||||||
"SDL2MIXER_OPUS OFF"
|
|
||||||
"SDL2MIXER_VORBIS STB"
|
|
||||||
"SDL2MIXER_WAVE ON"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME ZLIB
|
|
||||||
VERSION 1.2.13
|
|
||||||
URL "https://github.com/madler/zlib/archive/refs/tags/v1.2.13.zip"
|
|
||||||
EXCLUDE_FROM_ALL
|
|
||||||
DOWNLOAD_ONLY YES
|
|
||||||
)
|
|
||||||
if(ZLIB_ADDED)
|
|
||||||
set(ZLIB_SRCS
|
|
||||||
crc32.h
|
|
||||||
deflate.h
|
|
||||||
gzguts.h
|
|
||||||
inffast.h
|
|
||||||
inffixed.h
|
|
||||||
inflate.h
|
|
||||||
inftrees.h
|
|
||||||
trees.h
|
|
||||||
zutil.h
|
|
||||||
|
|
||||||
adler32.c
|
|
||||||
compress.c
|
|
||||||
crc32.c
|
|
||||||
deflate.c
|
|
||||||
gzclose.c
|
|
||||||
gzlib.c
|
|
||||||
gzread.c
|
|
||||||
gzwrite.c
|
|
||||||
inflate.c
|
|
||||||
infback.c
|
|
||||||
inftrees.c
|
|
||||||
inffast.c
|
|
||||||
trees.c
|
|
||||||
uncompr.c
|
|
||||||
zutil.c
|
|
||||||
)
|
|
||||||
list(TRANSFORM ZLIB_SRCS PREPEND "${ZLIB_SOURCE_DIR}/")
|
|
||||||
|
|
||||||
configure_file("${ZLIB_SOURCE_DIR}/zlib.pc.cmakein" "${ZLIB_BINARY_DIR}/zlib.pc" @ONLY)
|
|
||||||
configure_file("${ZLIB_SOURCE_DIR}/zconf.h.cmakein" "${ZLIB_BINARY_DIR}/include/zconf.h" @ONLY)
|
|
||||||
configure_file("${ZLIB_SOURCE_DIR}/zlib.h" "${ZLIB_BINARY_DIR}/include/zlib.h" @ONLY)
|
|
||||||
|
|
||||||
add_library(ZLIB ${SRB2_INTERNAL_LIBRARY_TYPE} ${ZLIB_SRCS})
|
|
||||||
set_target_properties(ZLIB PROPERTIES
|
|
||||||
VERSION 1.2.13
|
|
||||||
OUTPUT_NAME "z"
|
|
||||||
)
|
|
||||||
target_include_directories(ZLIB PRIVATE "${ZLIB_SOURCE_DIR}")
|
|
||||||
target_include_directories(ZLIB PUBLIC "${ZLIB_BINARY_DIR}/include")
|
|
||||||
if(MSVC)
|
|
||||||
target_compile_definitions(ZLIB PRIVATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
|
||||||
endif()
|
|
||||||
add_library(ZLIB::ZLIB ALIAS ZLIB)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME png
|
|
||||||
VERSION 1.6.38
|
|
||||||
URL "https://github.com/glennrp/libpng/archive/refs/tags/v1.6.38.zip"
|
|
||||||
# png cmake build is broken on msys/mingw32
|
|
||||||
DOWNLOAD_ONLY YES
|
|
||||||
)
|
|
||||||
|
|
||||||
if(png_ADDED)
|
|
||||||
# Since png's cmake build is broken, we're going to create a target manually
|
|
||||||
set(
|
|
||||||
PNG_SOURCES
|
|
||||||
|
|
||||||
png.h
|
|
||||||
pngconf.h
|
|
||||||
|
|
||||||
pngpriv.h
|
|
||||||
pngdebug.h
|
|
||||||
pnginfo.h
|
|
||||||
pngstruct.h
|
|
||||||
|
|
||||||
png.c
|
|
||||||
pngerror.c
|
|
||||||
pngget.c
|
|
||||||
pngmem.c
|
|
||||||
pngpread.c
|
|
||||||
pngread.c
|
|
||||||
pngrio.c
|
|
||||||
pngrtran.c
|
|
||||||
pngrutil.c
|
|
||||||
pngset.c
|
|
||||||
pngtrans.c
|
|
||||||
pngwio.c
|
|
||||||
pngwrite.c
|
|
||||||
pngwtran.c
|
|
||||||
pngwutil.c
|
|
||||||
)
|
|
||||||
list(TRANSFORM PNG_SOURCES PREPEND "${png_SOURCE_DIR}/")
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${png_BINARY_DIR}/include/png.h" "${png_BINARY_DIR}/include/pngconf.h"
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy "${png_SOURCE_DIR}/png.h" "${png_SOURCE_DIR}/pngconf.h" "${png_BINARY_DIR}/include"
|
|
||||||
DEPENDS "${png_SOURCE_DIR}/png.h" "${png_SOURCE_DIR}/pngconf.h"
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${png_BINARY_DIR}/include/pnglibconf.h"
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy "${png_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt" "${png_BINARY_DIR}/include/pnglibconf.h"
|
|
||||||
DEPENDS "${png_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt"
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
list(
|
|
||||||
APPEND PNG_SOURCES
|
|
||||||
"${png_BINARY_DIR}/include/png.h"
|
|
||||||
"${png_BINARY_DIR}/include/pngconf.h"
|
|
||||||
"${png_BINARY_DIR}/include/pnglibconf.h"
|
|
||||||
)
|
|
||||||
add_library(png "${SRB2_INTERNAL_LIBRARY_TYPE}" ${PNG_SOURCES})
|
|
||||||
|
|
||||||
# Disable ARM NEON since having it automatic breaks libpng external build on clang for some reason
|
|
||||||
target_compile_definitions(png PRIVATE -DPNG_ARM_NEON_OPT=0)
|
|
||||||
|
|
||||||
# The png includes need to be available to consumers
|
|
||||||
target_include_directories(png PUBLIC "${png_BINARY_DIR}/include")
|
|
||||||
|
|
||||||
# ... and these also need to be present only for png build
|
|
||||||
target_include_directories(png PRIVATE "${ZLIB_SOURCE_DIR}")
|
|
||||||
target_include_directories(png PRIVATE "${ZLIB_BINARY_DIR}")
|
|
||||||
target_include_directories(png PRIVATE "${png_BINARY_DIR}")
|
|
||||||
|
|
||||||
target_link_libraries(png PRIVATE ZLIB::ZLIB)
|
|
||||||
add_library(PNG::PNG ALIAS png)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
|
||||||
set(
|
|
||||||
internal_curl_options
|
|
||||||
|
|
||||||
"BUILD_CURL_EXE OFF"
|
|
||||||
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
|
||||||
"CURL_DISABLE_TESTS ON"
|
|
||||||
"HTTP_ONLY ON"
|
|
||||||
"CURL_DISABLE_CRYPTO_AUTH ON"
|
|
||||||
"CURL_DISABLE_NTLM ON"
|
|
||||||
"ENABLE_MANUAL OFF"
|
|
||||||
"ENABLE_THREADED_RESOLVER OFF"
|
|
||||||
"CURL_USE_LIBPSL OFF"
|
|
||||||
"CURL_USE_LIBSSH2 OFF"
|
|
||||||
"USE_LIBIDN2 OFF"
|
|
||||||
"CURL_ENABLE_EXPORT_TARGET OFF"
|
|
||||||
)
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
|
||||||
list(APPEND internal_curl_options "CURL_USE_OPENSSL OFF")
|
|
||||||
list(APPEND internal_curl_options "CURL_USE_SCHANNEL ON")
|
|
||||||
endif()
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
|
||||||
list(APPEND internal_curl_options "CURL_USE_OPENSSL OFF")
|
|
||||||
list(APPEND internal_curl_options "CURL_USE_SECTRANSP ON")
|
|
||||||
endif()
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
|
||||||
list(APPEND internal_curl_options "CURL_USE_OPENSSL ON")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME curl
|
|
||||||
VERSION 7.86.0
|
|
||||||
URL "https://github.com/curl/curl/archive/refs/tags/curl-7_86_0.zip"
|
|
||||||
EXCLUDE_FROM_ALL ON
|
|
||||||
OPTIONS ${internal_curl_options}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME openmpt
|
|
||||||
VERSION 0.4.30
|
|
||||||
URL "https://github.com/OpenMPT/openmpt/archive/refs/tags/libopenmpt-0.4.30.zip"
|
|
||||||
DOWNLOAD_ONLY ON
|
|
||||||
)
|
|
||||||
|
|
||||||
if(openmpt_ADDED)
|
|
||||||
set(
|
|
||||||
openmpt_SOURCES
|
|
||||||
|
|
||||||
# minimp3
|
|
||||||
# -DMPT_WITH_MINIMP3
|
|
||||||
include/minimp3/minimp3.c
|
|
||||||
|
|
||||||
common/mptStringParse.cpp
|
|
||||||
common/mptLibrary.cpp
|
|
||||||
common/Logging.cpp
|
|
||||||
common/Profiler.cpp
|
|
||||||
common/version.cpp
|
|
||||||
common/mptCPU.cpp
|
|
||||||
common/ComponentManager.cpp
|
|
||||||
common/mptOS.cpp
|
|
||||||
common/serialization_utils.cpp
|
|
||||||
common/mptStringFormat.cpp
|
|
||||||
common/FileReader.cpp
|
|
||||||
common/mptWine.cpp
|
|
||||||
common/mptPathString.cpp
|
|
||||||
common/mptAlloc.cpp
|
|
||||||
common/mptUUID.cpp
|
|
||||||
common/mptTime.cpp
|
|
||||||
common/mptString.cpp
|
|
||||||
common/mptFileIO.cpp
|
|
||||||
common/mptStringBuffer.cpp
|
|
||||||
common/mptRandom.cpp
|
|
||||||
common/mptIO.cpp
|
|
||||||
common/misc_util.cpp
|
|
||||||
|
|
||||||
common/mptCRC.h
|
|
||||||
common/mptLibrary.h
|
|
||||||
common/mptIO.h
|
|
||||||
common/version.h
|
|
||||||
common/stdafx.h
|
|
||||||
common/ComponentManager.h
|
|
||||||
common/Endianness.h
|
|
||||||
common/mptStringFormat.h
|
|
||||||
common/mptMutex.h
|
|
||||||
common/mptUUID.h
|
|
||||||
common/mptExceptionText.h
|
|
||||||
common/BuildSettings.h
|
|
||||||
common/mptAlloc.h
|
|
||||||
common/mptTime.h
|
|
||||||
common/FileReaderFwd.h
|
|
||||||
common/Logging.h
|
|
||||||
common/mptException.h
|
|
||||||
common/mptWine.h
|
|
||||||
common/mptStringBuffer.h
|
|
||||||
common/misc_util.h
|
|
||||||
common/mptBaseMacros.h
|
|
||||||
common/mptMemory.h
|
|
||||||
common/mptFileIO.h
|
|
||||||
common/serialization_utils.h
|
|
||||||
common/mptSpan.h
|
|
||||||
common/mptThread.h
|
|
||||||
common/FlagSet.h
|
|
||||||
common/mptString.h
|
|
||||||
common/mptStringParse.h
|
|
||||||
common/mptBaseUtils.h
|
|
||||||
common/mptRandom.h
|
|
||||||
common/CompilerDetect.h
|
|
||||||
common/FileReader.h
|
|
||||||
common/mptAssert.h
|
|
||||||
common/mptPathString.h
|
|
||||||
common/Profiler.h
|
|
||||||
common/mptOS.h
|
|
||||||
common/mptBaseTypes.h
|
|
||||||
common/mptCPU.h
|
|
||||||
common/mptBufferIO.h
|
|
||||||
common/versionNumber.h
|
|
||||||
|
|
||||||
soundlib/WAVTools.cpp
|
|
||||||
soundlib/ITTools.cpp
|
|
||||||
soundlib/AudioCriticalSection.cpp
|
|
||||||
soundlib/Load_stm.cpp
|
|
||||||
soundlib/MixerLoops.cpp
|
|
||||||
soundlib/Load_dbm.cpp
|
|
||||||
soundlib/ModChannel.cpp
|
|
||||||
soundlib/Load_gdm.cpp
|
|
||||||
soundlib/Snd_fx.cpp
|
|
||||||
soundlib/Load_mid.cpp
|
|
||||||
soundlib/mod_specifications.cpp
|
|
||||||
soundlib/Snd_flt.cpp
|
|
||||||
soundlib/Load_psm.cpp
|
|
||||||
soundlib/Load_far.cpp
|
|
||||||
soundlib/patternContainer.cpp
|
|
||||||
soundlib/Load_med.cpp
|
|
||||||
soundlib/Load_dmf.cpp
|
|
||||||
soundlib/Paula.cpp
|
|
||||||
soundlib/modcommand.cpp
|
|
||||||
soundlib/Message.cpp
|
|
||||||
soundlib/SoundFilePlayConfig.cpp
|
|
||||||
soundlib/Load_uax.cpp
|
|
||||||
soundlib/plugins/PlugInterface.cpp
|
|
||||||
soundlib/plugins/LFOPlugin.cpp
|
|
||||||
soundlib/plugins/PluginManager.cpp
|
|
||||||
soundlib/plugins/DigiBoosterEcho.cpp
|
|
||||||
soundlib/plugins/dmo/DMOPlugin.cpp
|
|
||||||
soundlib/plugins/dmo/Flanger.cpp
|
|
||||||
soundlib/plugins/dmo/Distortion.cpp
|
|
||||||
soundlib/plugins/dmo/ParamEq.cpp
|
|
||||||
soundlib/plugins/dmo/Gargle.cpp
|
|
||||||
soundlib/plugins/dmo/I3DL2Reverb.cpp
|
|
||||||
soundlib/plugins/dmo/Compressor.cpp
|
|
||||||
soundlib/plugins/dmo/WavesReverb.cpp
|
|
||||||
soundlib/plugins/dmo/Echo.cpp
|
|
||||||
soundlib/plugins/dmo/Chorus.cpp
|
|
||||||
soundlib/Load_ams.cpp
|
|
||||||
soundlib/tuningbase.cpp
|
|
||||||
soundlib/ContainerUMX.cpp
|
|
||||||
soundlib/Load_ptm.cpp
|
|
||||||
soundlib/ContainerXPK.cpp
|
|
||||||
soundlib/SampleFormatMP3.cpp
|
|
||||||
soundlib/tuning.cpp
|
|
||||||
soundlib/Sndfile.cpp
|
|
||||||
soundlib/ContainerMMCMP.cpp
|
|
||||||
soundlib/Load_amf.cpp
|
|
||||||
soundlib/Load_669.cpp
|
|
||||||
soundlib/modsmp_ctrl.cpp
|
|
||||||
soundlib/Load_mtm.cpp
|
|
||||||
soundlib/OggStream.cpp
|
|
||||||
soundlib/Load_plm.cpp
|
|
||||||
soundlib/Tables.cpp
|
|
||||||
soundlib/Load_c67.cpp
|
|
||||||
soundlib/Load_mod.cpp
|
|
||||||
soundlib/Load_sfx.cpp
|
|
||||||
soundlib/Sndmix.cpp
|
|
||||||
soundlib/load_j2b.cpp
|
|
||||||
soundlib/ModSequence.cpp
|
|
||||||
soundlib/SampleFormatFLAC.cpp
|
|
||||||
soundlib/ModInstrument.cpp
|
|
||||||
soundlib/Load_mo3.cpp
|
|
||||||
soundlib/ModSample.cpp
|
|
||||||
soundlib/Dlsbank.cpp
|
|
||||||
soundlib/Load_itp.cpp
|
|
||||||
soundlib/UpgradeModule.cpp
|
|
||||||
soundlib/MIDIMacros.cpp
|
|
||||||
soundlib/ContainerPP20.cpp
|
|
||||||
soundlib/RowVisitor.cpp
|
|
||||||
soundlib/Load_imf.cpp
|
|
||||||
soundlib/SampleFormatVorbis.cpp
|
|
||||||
soundlib/Load_dsm.cpp
|
|
||||||
soundlib/Load_mt2.cpp
|
|
||||||
soundlib/MixerSettings.cpp
|
|
||||||
soundlib/S3MTools.cpp
|
|
||||||
soundlib/Load_xm.cpp
|
|
||||||
soundlib/MIDIEvents.cpp
|
|
||||||
soundlib/pattern.cpp
|
|
||||||
soundlib/Load_digi.cpp
|
|
||||||
soundlib/Load_s3m.cpp
|
|
||||||
soundlib/tuningCollection.cpp
|
|
||||||
soundlib/SampleIO.cpp
|
|
||||||
soundlib/Dither.cpp
|
|
||||||
soundlib/Load_mdl.cpp
|
|
||||||
soundlib/OPL.cpp
|
|
||||||
soundlib/WindowedFIR.cpp
|
|
||||||
soundlib/SampleFormats.cpp
|
|
||||||
soundlib/Load_wav.cpp
|
|
||||||
soundlib/Load_it.cpp
|
|
||||||
soundlib/UMXTools.cpp
|
|
||||||
soundlib/Load_stp.cpp
|
|
||||||
soundlib/Load_okt.cpp
|
|
||||||
soundlib/Load_ult.cpp
|
|
||||||
soundlib/MixFuncTable.cpp
|
|
||||||
soundlib/SampleFormatOpus.cpp
|
|
||||||
soundlib/Fastmix.cpp
|
|
||||||
soundlib/Tagging.cpp
|
|
||||||
soundlib/ITCompression.cpp
|
|
||||||
soundlib/Load_dtm.cpp
|
|
||||||
soundlib/MPEGFrame.cpp
|
|
||||||
soundlib/XMTools.cpp
|
|
||||||
soundlib/SampleFormatMediaFoundation.cpp
|
|
||||||
soundlib/InstrumentExtensions.cpp
|
|
||||||
|
|
||||||
soundlib/MixerInterface.h
|
|
||||||
soundlib/SoundFilePlayConfig.h
|
|
||||||
soundlib/ModSample.h
|
|
||||||
soundlib/MIDIEvents.h
|
|
||||||
soundlib/ModSampleCopy.h
|
|
||||||
soundlib/patternContainer.h
|
|
||||||
soundlib/ChunkReader.h
|
|
||||||
soundlib/ITCompression.h
|
|
||||||
soundlib/Dither.h
|
|
||||||
soundlib/S3MTools.h
|
|
||||||
soundlib/MPEGFrame.h
|
|
||||||
soundlib/WAVTools.h
|
|
||||||
soundlib/mod_specifications.h
|
|
||||||
soundlib/ITTools.h
|
|
||||||
soundlib/RowVisitor.h
|
|
||||||
soundlib/plugins/PluginMixBuffer.h
|
|
||||||
soundlib/plugins/PluginStructs.h
|
|
||||||
soundlib/plugins/LFOPlugin.h
|
|
||||||
soundlib/plugins/PlugInterface.h
|
|
||||||
soundlib/plugins/DigiBoosterEcho.h
|
|
||||||
soundlib/plugins/OpCodes.h
|
|
||||||
soundlib/plugins/dmo/Echo.h
|
|
||||||
soundlib/plugins/dmo/I3DL2Reverb.h
|
|
||||||
soundlib/plugins/dmo/WavesReverb.h
|
|
||||||
soundlib/plugins/dmo/ParamEq.h
|
|
||||||
soundlib/plugins/dmo/Gargle.h
|
|
||||||
soundlib/plugins/dmo/DMOPlugin.h
|
|
||||||
soundlib/plugins/dmo/Chorus.h
|
|
||||||
soundlib/plugins/dmo/Compressor.h
|
|
||||||
soundlib/plugins/dmo/Distortion.h
|
|
||||||
soundlib/plugins/dmo/Flanger.h
|
|
||||||
soundlib/plugins/PluginManager.h
|
|
||||||
soundlib/SampleIO.h
|
|
||||||
soundlib/Container.h
|
|
||||||
soundlib/ModSequence.h
|
|
||||||
soundlib/UMXTools.h
|
|
||||||
soundlib/Message.h
|
|
||||||
soundlib/modcommand.h
|
|
||||||
soundlib/XMTools.h
|
|
||||||
soundlib/Snd_defs.h
|
|
||||||
soundlib/MixFuncTable.h
|
|
||||||
soundlib/pattern.h
|
|
||||||
soundlib/modsmp_ctrl.h
|
|
||||||
soundlib/Tagging.h
|
|
||||||
soundlib/tuningcollection.h
|
|
||||||
soundlib/Mixer.h
|
|
||||||
soundlib/FloatMixer.h
|
|
||||||
soundlib/AudioCriticalSection.h
|
|
||||||
soundlib/Tables.h
|
|
||||||
soundlib/tuningbase.h
|
|
||||||
soundlib/WindowedFIR.h
|
|
||||||
soundlib/Sndfile.h
|
|
||||||
soundlib/Paula.h
|
|
||||||
soundlib/ModInstrument.h
|
|
||||||
soundlib/Dlsbank.h
|
|
||||||
soundlib/IntMixer.h
|
|
||||||
soundlib/OPL.h
|
|
||||||
soundlib/Resampler.h
|
|
||||||
soundlib/ModChannel.h
|
|
||||||
soundlib/MixerSettings.h
|
|
||||||
soundlib/AudioReadTarget.h
|
|
||||||
soundlib/MixerLoops.h
|
|
||||||
soundlib/tuning.h
|
|
||||||
soundlib/MIDIMacros.h
|
|
||||||
soundlib/OggStream.h
|
|
||||||
soundlib/Loaders.h
|
|
||||||
soundlib/BitReader.h
|
|
||||||
soundlib/opal.h
|
|
||||||
|
|
||||||
sounddsp/AGC.cpp
|
|
||||||
sounddsp/EQ.cpp
|
|
||||||
sounddsp/DSP.cpp
|
|
||||||
sounddsp/Reverb.cpp
|
|
||||||
sounddsp/Reverb.h
|
|
||||||
sounddsp/EQ.h
|
|
||||||
sounddsp/DSP.h
|
|
||||||
sounddsp/AGC.h
|
|
||||||
|
|
||||||
libopenmpt/libopenmpt_c.cpp
|
|
||||||
libopenmpt/libopenmpt_cxx.cpp
|
|
||||||
libopenmpt/libopenmpt_impl.cpp
|
|
||||||
libopenmpt/libopenmpt_ext_impl.cpp
|
|
||||||
)
|
|
||||||
list(TRANSFORM openmpt_SOURCES PREPEND "${openmpt_SOURCE_DIR}/")
|
|
||||||
|
|
||||||
# -DLIBOPENMPT_BUILD
|
|
||||||
configure_file("openmpt_svn_version.h" "svn_version.h")
|
|
||||||
add_library(openmpt "${SRB2_INTERNAL_LIBRARY_TYPE}" ${openmpt_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/svn_version.h)
|
|
||||||
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU OR "${CMAKE_C_COMPILER_ID}" STREQUAL Clang OR "${CMAKE_C_COMPILER_ID}" STREQUAL AppleClang)
|
|
||||||
target_compile_options(openmpt PRIVATE "-g0")
|
|
||||||
endif()
|
|
||||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows AND "${CMAKE_C_COMPILER_ID}" STREQUAL MSVC)
|
|
||||||
target_link_libraries(openmpt PRIVATE Rpcrt4)
|
|
||||||
endif()
|
|
||||||
target_compile_features(openmpt PRIVATE cxx_std_11)
|
|
||||||
target_compile_definitions(openmpt PRIVATE -DLIBOPENMPT_BUILD)
|
|
||||||
|
|
||||||
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/common")
|
|
||||||
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/src")
|
|
||||||
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/include")
|
|
||||||
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}")
|
|
||||||
target_include_directories(openmpt PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
|
|
||||||
# I wish this wasn't necessary, but it is
|
|
||||||
target_include_directories(openmpt PUBLIC "${openmpt_SOURCE_DIR}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME libgme
|
|
||||||
VERSION 0.6.3
|
|
||||||
URL "https://bitbucket.org/mpyne/game-music-emu/get/e76bdc0cb916e79aa540290e6edd0c445879d3ba.zip"
|
|
||||||
EXCLUDE_FROM_ALL ON
|
|
||||||
OPTIONS
|
|
||||||
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
|
||||||
"ENABLE_UBSAN OFF"
|
|
||||||
"GME_YM2612_EMU MAME"
|
|
||||||
)
|
|
||||||
target_compile_features(gme PRIVATE cxx_std_11)
|
|
||||||
target_link_libraries(gme PRIVATE ZLIB::ZLIB)
|
|
||||||
endif()
|
|
||||||
|
|
35
thirdparty/cpm-curl.cmake
vendored
Normal file
35
thirdparty/cpm-curl.cmake
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
set(
|
||||||
|
internal_curl_options
|
||||||
|
|
||||||
|
"BUILD_CURL_EXE OFF"
|
||||||
|
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||||
|
"CURL_DISABLE_TESTS ON"
|
||||||
|
"HTTP_ONLY ON"
|
||||||
|
"CURL_DISABLE_CRYPTO_AUTH ON"
|
||||||
|
"CURL_DISABLE_NTLM ON"
|
||||||
|
"ENABLE_MANUAL OFF"
|
||||||
|
"ENABLE_THREADED_RESOLVER OFF"
|
||||||
|
"CURL_USE_LIBPSL OFF"
|
||||||
|
"CURL_USE_LIBSSH2 OFF"
|
||||||
|
"USE_LIBIDN2 OFF"
|
||||||
|
"CURL_ENABLE_EXPORT_TARGET OFF"
|
||||||
|
)
|
||||||
|
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||||
|
list(APPEND internal_curl_options "CURL_USE_OPENSSL OFF")
|
||||||
|
list(APPEND internal_curl_options "CURL_USE_SCHANNEL ON")
|
||||||
|
endif()
|
||||||
|
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||||
|
list(APPEND internal_curl_options "CURL_USE_OPENSSL OFF")
|
||||||
|
list(APPEND internal_curl_options "CURL_USE_SECTRANSP ON")
|
||||||
|
endif()
|
||||||
|
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||||
|
list(APPEND internal_curl_options "CURL_USE_OPENSSL ON")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME curl
|
||||||
|
VERSION 7.86.0
|
||||||
|
URL "https://github.com/curl/curl/archive/refs/tags/curl-7_86_0.zip"
|
||||||
|
EXCLUDE_FROM_ALL ON
|
||||||
|
OPTIONS ${internal_curl_options}
|
||||||
|
)
|
16
thirdparty/cpm-libgme.cmake
vendored
Normal file
16
thirdparty/cpm-libgme.cmake
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME libgme
|
||||||
|
VERSION 0.6.3
|
||||||
|
URL "https://bitbucket.org/mpyne/game-music-emu/get/e76bdc0cb916e79aa540290e6edd0c445879d3ba.zip"
|
||||||
|
EXCLUDE_FROM_ALL ON
|
||||||
|
OPTIONS
|
||||||
|
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||||
|
"ENABLE_UBSAN OFF"
|
||||||
|
"GME_YM2612_EMU MAME"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(libgme_ADDED)
|
||||||
|
target_compile_features(gme PRIVATE cxx_std_11)
|
||||||
|
# libgme's CMakeLists.txt already links this
|
||||||
|
#target_link_libraries(gme PRIVATE ZLIB::ZLIB)
|
||||||
|
endif()
|
289
thirdparty/cpm-openmpt.cmake
vendored
Normal file
289
thirdparty/cpm-openmpt.cmake
vendored
Normal file
|
@ -0,0 +1,289 @@
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME openmpt
|
||||||
|
VERSION 0.4.30
|
||||||
|
URL "https://github.com/OpenMPT/openmpt/archive/refs/tags/libopenmpt-0.4.30.zip"
|
||||||
|
DOWNLOAD_ONLY ON
|
||||||
|
)
|
||||||
|
|
||||||
|
if(openmpt_ADDED)
|
||||||
|
set(
|
||||||
|
openmpt_SOURCES
|
||||||
|
|
||||||
|
# minimp3
|
||||||
|
# -DMPT_WITH_MINIMP3
|
||||||
|
include/minimp3/minimp3.c
|
||||||
|
|
||||||
|
common/mptStringParse.cpp
|
||||||
|
common/mptLibrary.cpp
|
||||||
|
common/Logging.cpp
|
||||||
|
common/Profiler.cpp
|
||||||
|
common/version.cpp
|
||||||
|
common/mptCPU.cpp
|
||||||
|
common/ComponentManager.cpp
|
||||||
|
common/mptOS.cpp
|
||||||
|
common/serialization_utils.cpp
|
||||||
|
common/mptStringFormat.cpp
|
||||||
|
common/FileReader.cpp
|
||||||
|
common/mptWine.cpp
|
||||||
|
common/mptPathString.cpp
|
||||||
|
common/mptAlloc.cpp
|
||||||
|
common/mptUUID.cpp
|
||||||
|
common/mptTime.cpp
|
||||||
|
common/mptString.cpp
|
||||||
|
common/mptFileIO.cpp
|
||||||
|
common/mptStringBuffer.cpp
|
||||||
|
common/mptRandom.cpp
|
||||||
|
common/mptIO.cpp
|
||||||
|
common/misc_util.cpp
|
||||||
|
|
||||||
|
common/mptCRC.h
|
||||||
|
common/mptLibrary.h
|
||||||
|
common/mptIO.h
|
||||||
|
common/version.h
|
||||||
|
common/stdafx.h
|
||||||
|
common/ComponentManager.h
|
||||||
|
common/Endianness.h
|
||||||
|
common/mptStringFormat.h
|
||||||
|
common/mptMutex.h
|
||||||
|
common/mptUUID.h
|
||||||
|
common/mptExceptionText.h
|
||||||
|
common/BuildSettings.h
|
||||||
|
common/mptAlloc.h
|
||||||
|
common/mptTime.h
|
||||||
|
common/FileReaderFwd.h
|
||||||
|
common/Logging.h
|
||||||
|
common/mptException.h
|
||||||
|
common/mptWine.h
|
||||||
|
common/mptStringBuffer.h
|
||||||
|
common/misc_util.h
|
||||||
|
common/mptBaseMacros.h
|
||||||
|
common/mptMemory.h
|
||||||
|
common/mptFileIO.h
|
||||||
|
common/serialization_utils.h
|
||||||
|
common/mptSpan.h
|
||||||
|
common/mptThread.h
|
||||||
|
common/FlagSet.h
|
||||||
|
common/mptString.h
|
||||||
|
common/mptStringParse.h
|
||||||
|
common/mptBaseUtils.h
|
||||||
|
common/mptRandom.h
|
||||||
|
common/CompilerDetect.h
|
||||||
|
common/FileReader.h
|
||||||
|
common/mptAssert.h
|
||||||
|
common/mptPathString.h
|
||||||
|
common/Profiler.h
|
||||||
|
common/mptOS.h
|
||||||
|
common/mptBaseTypes.h
|
||||||
|
common/mptCPU.h
|
||||||
|
common/mptBufferIO.h
|
||||||
|
common/versionNumber.h
|
||||||
|
|
||||||
|
soundlib/WAVTools.cpp
|
||||||
|
soundlib/ITTools.cpp
|
||||||
|
soundlib/AudioCriticalSection.cpp
|
||||||
|
soundlib/Load_stm.cpp
|
||||||
|
soundlib/MixerLoops.cpp
|
||||||
|
soundlib/Load_dbm.cpp
|
||||||
|
soundlib/ModChannel.cpp
|
||||||
|
soundlib/Load_gdm.cpp
|
||||||
|
soundlib/Snd_fx.cpp
|
||||||
|
soundlib/Load_mid.cpp
|
||||||
|
soundlib/mod_specifications.cpp
|
||||||
|
soundlib/Snd_flt.cpp
|
||||||
|
soundlib/Load_psm.cpp
|
||||||
|
soundlib/Load_far.cpp
|
||||||
|
soundlib/patternContainer.cpp
|
||||||
|
soundlib/Load_med.cpp
|
||||||
|
soundlib/Load_dmf.cpp
|
||||||
|
soundlib/Paula.cpp
|
||||||
|
soundlib/modcommand.cpp
|
||||||
|
soundlib/Message.cpp
|
||||||
|
soundlib/SoundFilePlayConfig.cpp
|
||||||
|
soundlib/Load_uax.cpp
|
||||||
|
soundlib/plugins/PlugInterface.cpp
|
||||||
|
soundlib/plugins/LFOPlugin.cpp
|
||||||
|
soundlib/plugins/PluginManager.cpp
|
||||||
|
soundlib/plugins/DigiBoosterEcho.cpp
|
||||||
|
soundlib/plugins/dmo/DMOPlugin.cpp
|
||||||
|
soundlib/plugins/dmo/Flanger.cpp
|
||||||
|
soundlib/plugins/dmo/Distortion.cpp
|
||||||
|
soundlib/plugins/dmo/ParamEq.cpp
|
||||||
|
soundlib/plugins/dmo/Gargle.cpp
|
||||||
|
soundlib/plugins/dmo/I3DL2Reverb.cpp
|
||||||
|
soundlib/plugins/dmo/Compressor.cpp
|
||||||
|
soundlib/plugins/dmo/WavesReverb.cpp
|
||||||
|
soundlib/plugins/dmo/Echo.cpp
|
||||||
|
soundlib/plugins/dmo/Chorus.cpp
|
||||||
|
soundlib/Load_ams.cpp
|
||||||
|
soundlib/tuningbase.cpp
|
||||||
|
soundlib/ContainerUMX.cpp
|
||||||
|
soundlib/Load_ptm.cpp
|
||||||
|
soundlib/ContainerXPK.cpp
|
||||||
|
soundlib/SampleFormatMP3.cpp
|
||||||
|
soundlib/tuning.cpp
|
||||||
|
soundlib/Sndfile.cpp
|
||||||
|
soundlib/ContainerMMCMP.cpp
|
||||||
|
soundlib/Load_amf.cpp
|
||||||
|
soundlib/Load_669.cpp
|
||||||
|
soundlib/modsmp_ctrl.cpp
|
||||||
|
soundlib/Load_mtm.cpp
|
||||||
|
soundlib/OggStream.cpp
|
||||||
|
soundlib/Load_plm.cpp
|
||||||
|
soundlib/Tables.cpp
|
||||||
|
soundlib/Load_c67.cpp
|
||||||
|
soundlib/Load_mod.cpp
|
||||||
|
soundlib/Load_sfx.cpp
|
||||||
|
soundlib/Sndmix.cpp
|
||||||
|
soundlib/load_j2b.cpp
|
||||||
|
soundlib/ModSequence.cpp
|
||||||
|
soundlib/SampleFormatFLAC.cpp
|
||||||
|
soundlib/ModInstrument.cpp
|
||||||
|
soundlib/Load_mo3.cpp
|
||||||
|
soundlib/ModSample.cpp
|
||||||
|
soundlib/Dlsbank.cpp
|
||||||
|
soundlib/Load_itp.cpp
|
||||||
|
soundlib/UpgradeModule.cpp
|
||||||
|
soundlib/MIDIMacros.cpp
|
||||||
|
soundlib/ContainerPP20.cpp
|
||||||
|
soundlib/RowVisitor.cpp
|
||||||
|
soundlib/Load_imf.cpp
|
||||||
|
soundlib/SampleFormatVorbis.cpp
|
||||||
|
soundlib/Load_dsm.cpp
|
||||||
|
soundlib/Load_mt2.cpp
|
||||||
|
soundlib/MixerSettings.cpp
|
||||||
|
soundlib/S3MTools.cpp
|
||||||
|
soundlib/Load_xm.cpp
|
||||||
|
soundlib/MIDIEvents.cpp
|
||||||
|
soundlib/pattern.cpp
|
||||||
|
soundlib/Load_digi.cpp
|
||||||
|
soundlib/Load_s3m.cpp
|
||||||
|
soundlib/tuningCollection.cpp
|
||||||
|
soundlib/SampleIO.cpp
|
||||||
|
soundlib/Dither.cpp
|
||||||
|
soundlib/Load_mdl.cpp
|
||||||
|
soundlib/OPL.cpp
|
||||||
|
soundlib/WindowedFIR.cpp
|
||||||
|
soundlib/SampleFormats.cpp
|
||||||
|
soundlib/Load_wav.cpp
|
||||||
|
soundlib/Load_it.cpp
|
||||||
|
soundlib/UMXTools.cpp
|
||||||
|
soundlib/Load_stp.cpp
|
||||||
|
soundlib/Load_okt.cpp
|
||||||
|
soundlib/Load_ult.cpp
|
||||||
|
soundlib/MixFuncTable.cpp
|
||||||
|
soundlib/SampleFormatOpus.cpp
|
||||||
|
soundlib/Fastmix.cpp
|
||||||
|
soundlib/Tagging.cpp
|
||||||
|
soundlib/ITCompression.cpp
|
||||||
|
soundlib/Load_dtm.cpp
|
||||||
|
soundlib/MPEGFrame.cpp
|
||||||
|
soundlib/XMTools.cpp
|
||||||
|
soundlib/SampleFormatMediaFoundation.cpp
|
||||||
|
soundlib/InstrumentExtensions.cpp
|
||||||
|
|
||||||
|
soundlib/MixerInterface.h
|
||||||
|
soundlib/SoundFilePlayConfig.h
|
||||||
|
soundlib/ModSample.h
|
||||||
|
soundlib/MIDIEvents.h
|
||||||
|
soundlib/ModSampleCopy.h
|
||||||
|
soundlib/patternContainer.h
|
||||||
|
soundlib/ChunkReader.h
|
||||||
|
soundlib/ITCompression.h
|
||||||
|
soundlib/Dither.h
|
||||||
|
soundlib/S3MTools.h
|
||||||
|
soundlib/MPEGFrame.h
|
||||||
|
soundlib/WAVTools.h
|
||||||
|
soundlib/mod_specifications.h
|
||||||
|
soundlib/ITTools.h
|
||||||
|
soundlib/RowVisitor.h
|
||||||
|
soundlib/plugins/PluginMixBuffer.h
|
||||||
|
soundlib/plugins/PluginStructs.h
|
||||||
|
soundlib/plugins/LFOPlugin.h
|
||||||
|
soundlib/plugins/PlugInterface.h
|
||||||
|
soundlib/plugins/DigiBoosterEcho.h
|
||||||
|
soundlib/plugins/OpCodes.h
|
||||||
|
soundlib/plugins/dmo/Echo.h
|
||||||
|
soundlib/plugins/dmo/I3DL2Reverb.h
|
||||||
|
soundlib/plugins/dmo/WavesReverb.h
|
||||||
|
soundlib/plugins/dmo/ParamEq.h
|
||||||
|
soundlib/plugins/dmo/Gargle.h
|
||||||
|
soundlib/plugins/dmo/DMOPlugin.h
|
||||||
|
soundlib/plugins/dmo/Chorus.h
|
||||||
|
soundlib/plugins/dmo/Compressor.h
|
||||||
|
soundlib/plugins/dmo/Distortion.h
|
||||||
|
soundlib/plugins/dmo/Flanger.h
|
||||||
|
soundlib/plugins/PluginManager.h
|
||||||
|
soundlib/SampleIO.h
|
||||||
|
soundlib/Container.h
|
||||||
|
soundlib/ModSequence.h
|
||||||
|
soundlib/UMXTools.h
|
||||||
|
soundlib/Message.h
|
||||||
|
soundlib/modcommand.h
|
||||||
|
soundlib/XMTools.h
|
||||||
|
soundlib/Snd_defs.h
|
||||||
|
soundlib/MixFuncTable.h
|
||||||
|
soundlib/pattern.h
|
||||||
|
soundlib/modsmp_ctrl.h
|
||||||
|
soundlib/Tagging.h
|
||||||
|
soundlib/tuningcollection.h
|
||||||
|
soundlib/Mixer.h
|
||||||
|
soundlib/FloatMixer.h
|
||||||
|
soundlib/AudioCriticalSection.h
|
||||||
|
soundlib/Tables.h
|
||||||
|
soundlib/tuningbase.h
|
||||||
|
soundlib/WindowedFIR.h
|
||||||
|
soundlib/Sndfile.h
|
||||||
|
soundlib/Paula.h
|
||||||
|
soundlib/ModInstrument.h
|
||||||
|
soundlib/Dlsbank.h
|
||||||
|
soundlib/IntMixer.h
|
||||||
|
soundlib/OPL.h
|
||||||
|
soundlib/Resampler.h
|
||||||
|
soundlib/ModChannel.h
|
||||||
|
soundlib/MixerSettings.h
|
||||||
|
soundlib/AudioReadTarget.h
|
||||||
|
soundlib/MixerLoops.h
|
||||||
|
soundlib/tuning.h
|
||||||
|
soundlib/MIDIMacros.h
|
||||||
|
soundlib/OggStream.h
|
||||||
|
soundlib/Loaders.h
|
||||||
|
soundlib/BitReader.h
|
||||||
|
soundlib/opal.h
|
||||||
|
|
||||||
|
sounddsp/AGC.cpp
|
||||||
|
sounddsp/EQ.cpp
|
||||||
|
sounddsp/DSP.cpp
|
||||||
|
sounddsp/Reverb.cpp
|
||||||
|
sounddsp/Reverb.h
|
||||||
|
sounddsp/EQ.h
|
||||||
|
sounddsp/DSP.h
|
||||||
|
sounddsp/AGC.h
|
||||||
|
|
||||||
|
libopenmpt/libopenmpt_c.cpp
|
||||||
|
libopenmpt/libopenmpt_cxx.cpp
|
||||||
|
libopenmpt/libopenmpt_impl.cpp
|
||||||
|
libopenmpt/libopenmpt_ext_impl.cpp
|
||||||
|
)
|
||||||
|
list(TRANSFORM openmpt_SOURCES PREPEND "${openmpt_SOURCE_DIR}/")
|
||||||
|
|
||||||
|
# -DLIBOPENMPT_BUILD
|
||||||
|
configure_file("openmpt_svn_version.h" "svn_version.h")
|
||||||
|
add_library(openmpt "${SRB2_INTERNAL_LIBRARY_TYPE}" ${openmpt_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/svn_version.h)
|
||||||
|
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU OR "${CMAKE_C_COMPILER_ID}" STREQUAL Clang OR "${CMAKE_C_COMPILER_ID}" STREQUAL AppleClang)
|
||||||
|
target_compile_options(openmpt PRIVATE "-g0")
|
||||||
|
endif()
|
||||||
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows AND "${CMAKE_C_COMPILER_ID}" STREQUAL MSVC)
|
||||||
|
target_link_libraries(openmpt PRIVATE Rpcrt4)
|
||||||
|
endif()
|
||||||
|
target_compile_features(openmpt PRIVATE cxx_std_11)
|
||||||
|
target_compile_definitions(openmpt PRIVATE -DLIBOPENMPT_BUILD)
|
||||||
|
|
||||||
|
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/common")
|
||||||
|
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/src")
|
||||||
|
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/include")
|
||||||
|
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}")
|
||||||
|
target_include_directories(openmpt PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
|
# I wish this wasn't necessary, but it is
|
||||||
|
target_include_directories(openmpt PUBLIC "${openmpt_SOURCE_DIR}")
|
||||||
|
endif()
|
69
thirdparty/cpm-png.cmake
vendored
Normal file
69
thirdparty/cpm-png.cmake
vendored
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME png
|
||||||
|
VERSION 1.6.38
|
||||||
|
URL "https://github.com/glennrp/libpng/archive/refs/tags/v1.6.38.zip"
|
||||||
|
# png cmake build is broken on msys/mingw32
|
||||||
|
DOWNLOAD_ONLY YES
|
||||||
|
)
|
||||||
|
|
||||||
|
if(png_ADDED)
|
||||||
|
# Since png's cmake build is broken, we're going to create a target manually
|
||||||
|
set(
|
||||||
|
PNG_SOURCES
|
||||||
|
png.h
|
||||||
|
pngconf.h
|
||||||
|
pngpriv.h
|
||||||
|
pngdebug.h
|
||||||
|
pnginfo.h
|
||||||
|
pngstruct.h
|
||||||
|
png.c
|
||||||
|
pngerror.c
|
||||||
|
pngget.c
|
||||||
|
pngmem.c
|
||||||
|
pngpread.c
|
||||||
|
pngread.c
|
||||||
|
pngrio.c
|
||||||
|
pngrtran.c
|
||||||
|
pngrutil.c
|
||||||
|
pngset.c
|
||||||
|
pngtrans.c
|
||||||
|
pngwio.c
|
||||||
|
pngwrite.c
|
||||||
|
pngwtran.c
|
||||||
|
pngwutil.c
|
||||||
|
)
|
||||||
|
list(TRANSFORM PNG_SOURCES PREPEND "${png_SOURCE_DIR}/")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${png_BINARY_DIR}/include/png.h" "${png_BINARY_DIR}/include/pngconf.h"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy "${png_SOURCE_DIR}/png.h" "${png_SOURCE_DIR}/pngconf.h" "${png_BINARY_DIR}/include"
|
||||||
|
DEPENDS "${png_SOURCE_DIR}/png.h" "${png_SOURCE_DIR}/pngconf.h"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${png_BINARY_DIR}/include/pnglibconf.h"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy "${png_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt" "${png_BINARY_DIR}/include/pnglibconf.h"
|
||||||
|
DEPENDS "${png_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
list(
|
||||||
|
APPEND PNG_SOURCES
|
||||||
|
"${png_BINARY_DIR}/include/png.h"
|
||||||
|
"${png_BINARY_DIR}/include/pngconf.h"
|
||||||
|
"${png_BINARY_DIR}/include/pnglibconf.h"
|
||||||
|
)
|
||||||
|
add_library(png "${SRB2_INTERNAL_LIBRARY_TYPE}" ${PNG_SOURCES})
|
||||||
|
|
||||||
|
# Disable ARM NEON since having it automatic breaks libpng external build on clang for some reason
|
||||||
|
target_compile_definitions(png PRIVATE -DPNG_ARM_NEON_OPT=0)
|
||||||
|
|
||||||
|
# The png includes need to be available to consumers
|
||||||
|
target_include_directories(png PUBLIC "${png_BINARY_DIR}/include")
|
||||||
|
|
||||||
|
# ... and these also need to be present only for png build
|
||||||
|
target_include_directories(png PRIVATE "${ZLIB_SOURCE_DIR}")
|
||||||
|
target_include_directories(png PRIVATE "${ZLIB_BINARY_DIR}")
|
||||||
|
target_include_directories(png PRIVATE "${png_BINARY_DIR}")
|
||||||
|
target_link_libraries(png PRIVATE ZLIB::ZLIB)
|
||||||
|
add_library(PNG::PNG ALIAS png)
|
||||||
|
endif()
|
22
thirdparty/cpm-sdl2-mixer.cmake
vendored
Normal file
22
thirdparty/cpm-sdl2-mixer.cmake
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME SDL2_mixer
|
||||||
|
VERSION 2.6.2
|
||||||
|
URL "https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/release-2.6.2.zip"
|
||||||
|
EXCLUDE_FROM_ALL ON
|
||||||
|
OPTIONS
|
||||||
|
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||||
|
"SDL2MIXER_INSTALL OFF"
|
||||||
|
"SDL2MIXER_DEPS_SHARED OFF"
|
||||||
|
"SDL2MIXER_SAMPLES OFF"
|
||||||
|
"SDL2MIXER_VENDORED ON"
|
||||||
|
"SDL2MIXER_FLAC ON"
|
||||||
|
"SDL2MIXER_FLAC_LIBFLAC OFF"
|
||||||
|
"SDL2MIXER_FLAC_DRFLAC ON"
|
||||||
|
"SDL2MIXER_MOD OFF"
|
||||||
|
"SDL2MIXER_MP3 ON"
|
||||||
|
"SDL2MIXER_MP3_DRMP3 ON"
|
||||||
|
"SDL2MIXER_MIDI ON"
|
||||||
|
"SDL2MIXER_OPUS OFF"
|
||||||
|
"SDL2MIXER_VORBIS STB"
|
||||||
|
"SDL2MIXER_WAVE ON"
|
||||||
|
)
|
13
thirdparty/cpm-sdl2.cmake
vendored
Normal file
13
thirdparty/cpm-sdl2.cmake
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME SDL2
|
||||||
|
VERSION 2.24.2
|
||||||
|
URL "https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.24.2.zip"
|
||||||
|
EXCLUDE_FROM_ALL ON
|
||||||
|
OPTIONS
|
||||||
|
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||||
|
"SDL_SHARED ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||||
|
"SDL_STATIC ${NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||||
|
"SDL_TEST OFF"
|
||||||
|
"SDL2_DISABLE_SDL2MAIN ON"
|
||||||
|
"SDL2_DISABLE_INSTALL ON"
|
||||||
|
)
|
53
thirdparty/cpm-zlib.cmake
vendored
Normal file
53
thirdparty/cpm-zlib.cmake
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME ZLIB
|
||||||
|
VERSION 1.2.13
|
||||||
|
URL "https://github.com/madler/zlib/archive/refs/tags/v1.2.13.zip"
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
DOWNLOAD_ONLY YES
|
||||||
|
)
|
||||||
|
|
||||||
|
if(ZLIB_ADDED)
|
||||||
|
set(ZLIB_SRCS
|
||||||
|
crc32.h
|
||||||
|
deflate.h
|
||||||
|
gzguts.h
|
||||||
|
inffast.h
|
||||||
|
inffixed.h
|
||||||
|
inflate.h
|
||||||
|
inftrees.h
|
||||||
|
trees.h
|
||||||
|
zutil.h
|
||||||
|
adler32.c
|
||||||
|
compress.c
|
||||||
|
crc32.c
|
||||||
|
deflate.c
|
||||||
|
gzclose.c
|
||||||
|
gzlib.c
|
||||||
|
gzread.c
|
||||||
|
gzwrite.c
|
||||||
|
inflate.c
|
||||||
|
infback.c
|
||||||
|
inftrees.c
|
||||||
|
inffast.c
|
||||||
|
trees.c
|
||||||
|
uncompr.c
|
||||||
|
zutil.c
|
||||||
|
)
|
||||||
|
list(TRANSFORM ZLIB_SRCS PREPEND "${ZLIB_SOURCE_DIR}/")
|
||||||
|
|
||||||
|
configure_file("${ZLIB_SOURCE_DIR}/zlib.pc.cmakein" "${ZLIB_BINARY_DIR}/zlib.pc" @ONLY)
|
||||||
|
configure_file("${ZLIB_SOURCE_DIR}/zconf.h.cmakein" "${ZLIB_BINARY_DIR}/include/zconf.h" @ONLY)
|
||||||
|
configure_file("${ZLIB_SOURCE_DIR}/zlib.h" "${ZLIB_BINARY_DIR}/include/zlib.h" @ONLY)
|
||||||
|
|
||||||
|
add_library(ZLIB ${SRB2_INTERNAL_LIBRARY_TYPE} ${ZLIB_SRCS})
|
||||||
|
set_target_properties(ZLIB PROPERTIES
|
||||||
|
VERSION 1.2.13
|
||||||
|
OUTPUT_NAME "z"
|
||||||
|
)
|
||||||
|
target_include_directories(ZLIB PRIVATE "${ZLIB_SOURCE_DIR}")
|
||||||
|
target_include_directories(ZLIB PUBLIC "${ZLIB_BINARY_DIR}/include")
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_definitions(ZLIB PRIVATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
|
endif()
|
||||||
|
add_library(ZLIB::ZLIB ALIAS ZLIB)
|
||||||
|
endif()
|
|
@ -22,7 +22,6 @@
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#endif
|
#endif
|
||||||
#define NOASM
|
|
||||||
#include "../src/tables.h"
|
#include "../src/tables.h"
|
||||||
#define NO_M
|
#define NO_M
|
||||||
#include "../src/m_fixed.c"
|
#include "../src/m_fixed.c"
|
||||||
|
|
Loading…
Reference in a new issue