Merge remote-tracking branch 'origin/master' into pitch-roll

This commit is contained in:
lachablock 2022-03-25 22:28:33 +11:00
commit a1ec1248f1
339 changed files with 15066 additions and 9187 deletions

4
.gitignore vendored
View file

@ -13,11 +13,11 @@ Win32_LIB_ASM_Release
*.dgb
*.debug
*.debug.txt
/bin/VC10/
/objs/VC10/
*.user
*.db
*.opendb
/.vs
/debian
/assets/debian
/make
/bin

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.13)
# Enable CCache early
set(SRB2_USE_CCACHE OFF CACHE BOOL "Use CCache")
@ -34,12 +34,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
### Useful functions
# Prepend sources with current source directory
function(prepend_sources SOURCE_FILES)
foreach(SOURCE_FILE ${${SOURCE_FILES}})
set(MODIFIED ${MODIFIED} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
endforeach()
set(${SOURCE_FILES} ${MODIFIED} PARENT_SCOPE)
# Add sources from Sourcefile
function(target_sourcefile type)
file(STRINGS Sourcefile list
REGEX "[-0-9A-Za-z_]+\.${type}")
target_sources(SRB2SDL2 PRIVATE ${list})
endfunction()
# Macro to add OSX framework

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
ifdef SILENT
MAKEFLAGS+=--no-print-directory
endif
all :
% ::
@$(MAKE) -C src $(MAKECMDGOALS)

View file

@ -1,4 +1,5 @@
# Sonic Robo Blast 2
[![latest release](https://badgen.net/github/release/STJr/SRB2/stable)](https://github.com/STJr/SRB2/releases/latest)
[![Build status](https://ci.appveyor.com/api/projects/status/399d4hcw9yy7hg2y?svg=true)](https://ci.appveyor.com/project/STJr/srb2)
[![Build status](https://travis-ci.org/STJr/SRB2.svg?branch=master)](https://travis-ci.org/STJr/SRB2)

View file

@ -1,16 +1,12 @@
version: 2.2.9.{branch}-{build}
version: 2.2.10.{branch}-{build}
os: MinGW
environment:
CC: ccache
CCACHE_CC: i686-w64-mingw32-gcc
CCACHE_CC_64: x86_64-w64-mingw32-gcc
CC: i686-w64-mingw32-gcc
WINDRES: windres
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
MINGW_SDK: c:\msys64\mingw32
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead
MINGW_SDK_64: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
CFLAGS: -Wall -W -Werror -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3 -Wno-tautological-compare -Wno-error=suggest-attribute=noreturn
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
@ -19,8 +15,6 @@ environment:
CCACHE_URL: http://alam.srb2.org/ccache.exe
CCACHE_COMPRESS: true
CCACHE_DIR: C:\Users\appveyor\.ccache
# Disable UPX by default. The user can override this in their Appveyor project settings
NOUPX: 1
##############################
# DEPLOYER VARIABLES
# DPL_ENABLED=1 builds installers for branch names starting with `deployer`.
@ -53,11 +47,6 @@ cache:
- C:\Users\appveyor\srb2_cache
install:
- if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" )
- if [%CONFIGURATION%] == [SDL64] ( set "CONFIGURATION=SDL" )
- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" )
- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" )
- 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
@ -72,43 +61,31 @@ install:
configuration:
- SDL
- SDL64
before_build:
- set "Path=%MINGW_SDK%\bin;%Path%"
- if [%X86_64%] == [1] ( x86_64-w64-mingw32-gcc --version ) else ( i686-w64-mingw32-gcc --version )
- mingw32-make --version
- if not [%X86_64%] == [1] ( nasm -v )
- nasm -v
- if not [%NOUPX%] == [1] ( upx -V )
- ccache -V
- ccache -s
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
- if defined [%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%] ( set "COMMIT=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%" ) else ( set "COMMIT=%APPVEYOR_REPO_COMMIT%" )
- cmd: git rev-parse --short %COMMIT%>%TMP%/gitshort.txt
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt
# for pull requests, take the owner's name only, if this isn't the same repo of course
- set "REPO=%APPVEYOR_REPO_BRANCH%"
- if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [] ( if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [%APPVEYOR_REPO_NAME%] ( for /f "delims=/" %%a in ("%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%") do set "REPO=%%a-%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%" ) )
- set "EXENAME=EXENAME=srb2win-%REPO%-%GITSHORT%.exe"
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 NOOBJDUMP=1 %NOUPX% %EXENAME%"
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1 GCC81=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"
- set "SRB2_MFLAGS=-C src NOECHOFILENAMES=1 CCACHE=1 EXENAME=srb2win-%REPO%-%GITSHORT%.exe"
build_script:
- cmd: mingw32-make.exe %SRB2_MFLAGS% clean
- cmd: mingw32-make.exe %SRB2_MFLAGS% ERRORMODE=1 -k
after_build:
- if [%X86_64%] == [1] (
set "BUILD_PATH=bin\Mingw64\Release"
) else (
set "BUILD_PATH=bin\Mingw\Release"
)
- if [%X86_64%] == [1] ( set "CONFIGURATION=%CONFIGURATION%64" )
- ccache -s
- set BUILD_ARCHIVE=%REPO%-%GITSHORT%-%CONFIGURATION%.7z
- set BUILDSARCHIVE=%REPO%-%CONFIGURATION%.7z
- cmd: 7z a %BUILD_ARCHIVE% %BUILD_PATH% -xr!.gitignore
- cmd: 7z a %BUILD_ARCHIVE% bin -xr!.gitignore
- appveyor PushArtifact %BUILD_ARCHIVE%
#- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
#- appveyor PushArtifact %BUILDSARCHIVE%
@ -139,3 +116,4 @@ test: off
on_finish:
#- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:<ip>:<port>
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# vim: et ts=1

View file

@ -22,8 +22,7 @@ set(SRB2_ASSET_INSTALL ON
set(SRB2_ASSET_HASHED
"srb2.pk3;\
player.dta;\
zones.pk3;\
patch.pk3"
zones.pk3"
CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!"
)

View file

@ -1,24 +1,21 @@
SONIC ROBO BLAST 2
Sonic Robo Blast 2 (SRB2) is a 3D Sonic the Hedgehog fangame based on a
modified version of Doom Legacy.
Sonic Robo Blast 2 (SRB2) is a 3D Sonic the Hedgehog fangame, based on a modified version of Doom Legacy.
https://www.srb2.org
LICENSE
The source code for SRB2 is licensed under the GNU General Public
License, Version 2. See LICENSE.txt for the full text of this license.
The source code for SRB2 is licensed under the GNU General Public License, Version 2. See LICENSE.txt for the full text of this license.
SRB2 uses various third-party libraries, including SDL, SDL Mixer, and
their dependencies. See LICENSE-3RD-PARTY.txt for the licenses of these
libraries.
SRB2 uses various third-party libraries, including SDL, SDL Mixer, and their dependencies. See LICENSE-3RD-PARTY.txt for the licenses of these libraries.
SOURCE CODE
You may obtain the source code for SRB2, including the source code for
specific version releases, at the following web sites:
You may obtain the source code for SRB2, including the source code for specific version releases, at the following web sites:
STJr GitLab:
https://git.magicalgirl.moe/STJr/SRB2
https://git.do.srb2.org/STJr/SRB2
GitHub:
https://github.com/STJr/SRB2
@ -27,25 +24,27 @@ CONTACT
You may contact Sonic Team Junior via the following web sites:
SRB2.ORG:
https://www.srb2.org
SRB2 Message Board:
https://mb.srb2.org
SRB2 Official Discord:
https://discord.gg/pYDXzpX (13+)
https://discord.gg/b3BGb8A
Twitter:
https://twitter.com/SonicTeamJr
Facebook:
https://facebook.com/SonicRoboBlast2
COPYRIGHT AND DISCLAIMER
Design and content on SRB2 is copyright 1998-2019 by Sonic Team Junior.
All non-original material on SRB2.ORG is copyrighted by their
respective owners, and no copyright infringement is intended. The owner
of the SRB2.ORG domain is only acting as an ISP, and is therefore not
responsible for any content on SRB2.ORG under the 1998 DMCA. This
site, its webmaster, and its staff make no profit whatsoever (in fact,
we lose money). Sonic Team Junior assumes no responsibility for the
content on any Sonic Team Junior fan sites.
Design and content in Sonic Robo Blast 2 is copyright 1998-2022 by Sonic Team Jr.
Sonic Team Junior is in no way affiliated with SEGA or Sonic Team. We do
not claim ownership of any of SEGA's intellectual property used in SRB2.
All original material in this game is copyrighted by their respective owners, and no copyright infringement is intended. Sonic Team Jr. is in no way affiliated with SEGA or Sonic Team, and we do not claim ownership of any of SEGA's intellectual property used in SRB2.
Sonic Robo Blast 2 is not commercial software. If you purchased this game, you have been scammed! Sonic Team Jr.'s staff makes no profit whatsoever (in fact, we lose money).
The owner of the srb2.org domain is only acting as an ISP, and is therefore not responsible for any content on srb2.org under the 1998 DMCA. Sonic Team Jr. assumes no responsibility for the content on any Sonic Team Jr. fan sites.
This software is provided as-is with no warranty whatsoever.

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1,3 +0,0 @@
/lsdlsrb2
/pnd
/*.mo

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1,3 +0,0 @@
*.exe
*.mo
r_opengl.dll

View file

@ -1,4 +0,0 @@
*.exe
*.mo
r_opengl.dll
*.bat

View file

@ -1,3 +0,0 @@
/srb2sdl.exe
/srb2win.exe
/r_opengl.dll

View file

@ -1,3 +0,0 @@
/srb2sdl.exe
/srb2win.exe
/r_opengl.dll

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/VC/.gitignore vendored
View file

@ -1,2 +0,0 @@
/Release
/Debug

2
bin/VC9/.gitignore vendored
View file

@ -1,2 +0,0 @@
/Win32
/x64

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -78,7 +78,7 @@ NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "
MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) NOOBJDUMP=1 # SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
BINDIR := $(DIR)/bin/Linux/Release
BINDIR := $(DIR)/bin/
# FIXME pkg-config dir hacks
# Launchpad doesn't need this; it actually makes i386 builds fail due to cross-compile

2
dep/.gitignore vendored
View file

@ -1,2 +0,0 @@
#All folders
*.d

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/VC/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/VC9/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -640,22 +640,37 @@ linedeftypes
prefix = "(63)";
}
96
{
title = "Apply Tag to Tagged Sectors";
prefix = "(96)";
flags1024text = "[10] Offsets are target tags";
flags8192text = "[13] Use front side offsets";
flags32768text = "[15] Use back side offsets";
}
97
{
title = "Apply Tag to Front Sector";
prefix = "(97)";
flags8192text = "[13] Use front side offsets";
flags32768text = "[15] Use back side offsets";
}
98
{
title = "Apply Tag to Back Sector";
prefix = "(98)";
flags8192text = "[13] Use front side offsets";
flags32768text = "[15] Use back side offsets";
}
99
{
title = "Apply Tag to Front and Back Sectors";
prefix = "(99)";
flags8192text = "[13] Use front side offsets";
flags32768text = "[15] Use back side offsets";
}
540
@ -1076,6 +1091,7 @@ linedeftypes
{
title = "Water, Opaque";
prefix = "(120)";
flags2text = "[1] Make lava intangible";
flags8text = "[3] Slope skew sides";
flags64text = "[6] Use two light levels";
flags512text = "[9] Use target light level";
@ -1091,6 +1107,7 @@ linedeftypes
{
title = "Water, Translucent";
prefix = "(121)";
flags2text = "[1] Make lava intangible";
flags8text = "[3] Slope skew sides";
flags64text = "[6] Use two light levels";
flags512text = "[9] Use target light level";
@ -1107,6 +1124,7 @@ linedeftypes
{
title = "Water, Opaque, No Sides";
prefix = "(122)";
flags2text = "[1] Make lava intangible";
flags64text = "[6] Use two light levels";
flags512text = "[9] Use target light level";
flags1024text = "[10] Ripple effect";
@ -1121,6 +1139,7 @@ linedeftypes
{
title = "Water, Translucent, No Sides";
prefix = "(123)";
flags2text = "[1] Make lava intangible";
flags64text = "[6] Use two light levels";
flags512text = "[9] Use target light level";
flags1024text = "[10] Ripple effect";
@ -1136,6 +1155,7 @@ linedeftypes
{
title = "Goo Water, Translucent";
prefix = "(124)";
flags2text = "[1] Make lava intangible";
flags8text = "[3] Slope skew sides";
flags64text = "[6] Use two light levels";
flags512text = "[9] Use target light level";
@ -1152,6 +1172,7 @@ linedeftypes
{
title = "Goo Water, Translucent, No Sides";
prefix = "(125)";
flags2text = "[1] Make lava intangible";
flags64text = "[6] Use two light levels";
flags512text = "[9] Use target light level";
flags1024text = "[10] Ripple effect";
@ -1654,12 +1675,14 @@ linedeftypes
{
title = "Continuous";
prefix = "(300)";
flags1024text = "[10] Use faster, unordered execution";
}
301
{
title = "Each Time";
prefix = "(301)";
flags1024text = "[10] Use faster, unordered execution";
flags16384text = "[14] Also trigger on exit";
}
@ -1667,6 +1690,7 @@ linedeftypes
{
title = "Once";
prefix = "(302)";
flags1024text = "[10] Use faster, unordered execution";
}
303
@ -1676,6 +1700,7 @@ linedeftypes
flags2text = "[1] Rings greater or equal";
flags64text = "[6] Rings less or equal";
flags512text = "[9] Consider all players";
flags1024text = "[10] Use faster, unordered execution";
}
304
@ -1685,18 +1710,21 @@ linedeftypes
flags2text = "[1] Rings greater or equal";
flags64text = "[6] Rings less or equal";
flags512text = "[9] Consider all players";
flags1024text = "[10] Use faster, unordered execution";
}
305
{
title = "Character Ability - Continuous";
prefix = "(305)";
flags1024text = "[10] Use faster, unordered execution";
}
306
{
title = "Character Ability - Each Time";
prefix = "(306)";
flags1024text = "[10] Use faster, unordered execution";
flags16384text = "[14] Also trigger on exit";
}
@ -1704,24 +1732,28 @@ linedeftypes
{
title = "Character Ability - Once";
prefix = "(307)";
flags1024text = "[10] Use faster, unordered execution";
}
308
{
title = "Race Only - Once";
prefix = "(308)";
flags1024text = "[10] Use faster, unordered execution";
}
309
{
title = "CTF Red Team - Continuous";
prefix = "(309)";
flags1024text = "[10] Use faster, unordered execution";
}
310
{
title = "CTF Red Team - Each Time";
prefix = "(310)";
flags1024text = "[10] Use faster, unordered execution";
flags16384text = "[14] Also trigger on exit";
}
@ -1729,12 +1761,14 @@ linedeftypes
{
title = "CTF Blue Team - Continuous";
prefix = "(311)";
flags1024text = "[10] Use faster, unordered execution";
}
312
{
title = "CTF Blue Team - Each Time";
prefix = "(312)";
flags1024text = "[10] Use faster, unordered execution";
flags16384text = "[14] Also trigger on exit";
}
@ -1742,6 +1776,7 @@ linedeftypes
{
title = "No More Enemies - Once";
prefix = "(313)";
flags1024text = "[10] Use faster, unordered execution";
}
314
@ -1750,6 +1785,7 @@ linedeftypes
prefix = "(314)";
flags64text = "[6] Number greater or equal";
flags512text = "[9] Number less";
flags1024text = "[10] Use faster, unordered execution";
}
315
@ -1758,30 +1794,35 @@ linedeftypes
prefix = "(315)";
flags64text = "[6] Number greater or equal";
flags512text = "[9] Number less";
flags1024text = "[10] Use faster, unordered execution";
}
317
{
title = "Condition Set Trigger - Continuous";
prefix = "(317)";
flags1024text = "[10] Use faster, unordered execution";
}
318
{
title = "Condition Set Trigger - Once";
prefix = "(318)";
flags1024text = "[10] Use faster, unordered execution";
}
319
{
title = "Unlockable - Continuous";
prefix = "(319)";
flags1024text = "[10] Use faster, unordered execution";
}
320
{
title = "Unlockable - Once";
prefix = "(320)";
flags1024text = "[10] Use faster, unordered execution";
}
321
@ -1789,6 +1830,7 @@ linedeftypes
title = "Trigger After X Calls - Continuous";
prefix = "(321)";
flags64text = "[6] Trigger more than once";
flags1024text = "[10] Use faster, unordered execution";
}
@ -1797,6 +1839,7 @@ linedeftypes
title = "Trigger After X Calls - Each Time";
prefix = "(322)";
flags64text = "[6] Trigger more than once";
flags1024text = "[10] Use faster, unordered execution";
}
323
@ -1811,6 +1854,7 @@ linedeftypes
flags128text = "[7] Lap >= Front Y Offset";
flags256text = "[8] Count laps from Bonus Time";
flags512text = "[9] Count from triggering player";
flags1024text = "[10] Use faster, unordered execution";
flags16384text = "[14] Run if no more mares";
flags32768text = "[15] Run if player is not NiGHTS";
}
@ -1818,6 +1862,7 @@ linedeftypes
324
{
title = "NiGHTSerize - Once";
prefix = "(324)";
flags2text = "[1] Mare >= Front X Offset";
flags8text = "[3] Run only if player is NiGHTS";
flags16text = "[4] Count from lowest of players";
@ -1826,14 +1871,15 @@ linedeftypes
flags128text = "[7] Lap >= Front Y Offset";
flags256text = "[8] Count laps from Bonus Time";
flags512text = "[9] Count from triggering player";
flags1024text = "[10] Use faster, unordered execution";
flags16384text = "[14] Run if no more mares";
flags32768text = "[15] Run if player is not NiGHTS";
prefix = "(324)";
}
325
{
title = "De-NiGHTSerize - Each Time";
prefix = "(325)";
flags2text = "[1] Mare >= Front X Offset";
flags8text = "[3] Run if anyone is NiGHTS";
flags16text = "[4] Count from lowest of players";
@ -1842,13 +1888,14 @@ linedeftypes
flags128text = "[7] Lap >= Front Y Offset";
flags256text = "[8] Count laps from Bonus Time";
flags512text = "[9] Count from triggering player";
flags1024text = "[10] Use faster, unordered execution";
flags32768text = "[15] Run if no one is NiGHTS";
prefix = "(325)";
}
326
{
title = "De-NiGHTSerize - Once";
prefix = "(326)";
flags2text = "[1] Mare >= Front X Offset";
flags8text = "[3] Run if anyone is NiGHTS";
flags16text = "[4] Count from lowest of players";
@ -1857,13 +1904,14 @@ linedeftypes
flags128text = "[7] Lap >= Front Y Offset";
flags256text = "[8] Count laps from Bonus Time";
flags512text = "[9] Count from triggering player";
flags1024text = "[10] Use faster, unordered execution";
flags32768text = "[15] Run if no one is NiGHTS";
prefix = "(326)";
}
327
{
title = "NiGHTS Lap - Each Time";
prefix = "(327)";
flags2text = "[1] Mare >= Front X Offset";
flags16text = "[4] Count from lowest of players";
flags32text = "[5] Lap <= Front Y Offset";
@ -1871,12 +1919,13 @@ linedeftypes
flags128text = "[7] Lap >= Front Y Offset";
flags256text = "[8] Count laps from Bonus Time";
flags512text = "[9] Count from triggering player";
prefix = "(327)";
flags1024text = "[10] Use faster, unordered execution";
}
328
{
title = "NiGHTS Lap - Once";
prefix = "(328)";
flags2text = "[1] Mare >= Front X Offset";
flags16text = "[4] Count from lowest of players";
flags32text = "[5] Lap <= Front Y Offset";
@ -1884,12 +1933,13 @@ linedeftypes
flags128text = "[7] Lap >= Front Y Offset";
flags256text = "[8] Count laps from Bonus Time";
flags512text = "[9] Count from triggering player";
prefix = "(328)";
flags1024text = "[10] Use faster, unordered execution";
}
329
{
title = "Ideya Capture Touch - Each Time";
prefix = "(329)";
flags2text = "[1] Mare >= Front X Offset";
flags8text = "[3] Run regardless of spheres";
flags16text = "[4] Count from lowest of players";
@ -1898,14 +1948,15 @@ linedeftypes
flags128text = "[7] Lap >= Front Y Offset";
flags256text = "[8] Count laps from Bonus Time";
flags512text = "[9] Count from triggering player";
flags1024text = "[10] Use faster, unordered execution";
flags16384text = "[14] Only if not enough spheres";
flags32768text = "[15] Run when entering Capture";
prefix = "(329)";
}
330
{
title = "Ideya Capture Touch - Once";
prefix = "(330)";
flags2text = "[1] Mare >= Front X Offset";
flags8text = "[3] Run regardless of spheres";
flags16text = "[4] Count from lowest of players";
@ -1914,57 +1965,64 @@ linedeftypes
flags128text = "[7] Lap >= Front Y Offset";
flags256text = "[8] Count laps from Bonus Time";
flags512text = "[9] Count from triggering player";
flags1024text = "[10] Use faster, unordered execution";
flags16384text = "[14] Only if not enough spheres";
flags32768text = "[15] Run when entering Capture";
prefix = "(330)";
}
331
{
title = "Player Skin - Continuous";
flags64text = "[6] Disable for this skin";
prefix = "(331)";
flags64text = "[6] Disable for this skin";
flags1024text = "[10] Use faster, unordered execution";
}
332
{
title = "Player Skin - Each Time";
flags64text = "[6] Disable for this skin";
prefix = "(332)";
flags64text = "[6] Disable for this skin";
flags1024text = "[10] Use faster, unordered execution";
}
333
{
title = "Player Skin - Once";
flags64text = "[6] Disable for this skin";
prefix = "(333)";
flags64text = "[6] Disable for this skin";
flags1024text = "[10] Use faster, unordered execution";
}
334
{
title = "Object Dye - Continuous";
flags64text = "[6] Disable for this color";
prefix = "(334)";
flags64text = "[6] Disable for this color";
flags1024text = "[10] Use faster, unordered execution";
}
335
{
title = "Object Dye - Each Time";
flags64text = "[6] Disable for this color";
prefix = "(335)";
flags64text = "[6] Disable for this color";
flags1024text = "[10] Use faster, unordered execution";
}
336
{
title = "Object Dye - Once";
flags64text = "[6] Disable for this color";
prefix = "(336)";
flags64text = "[6] Disable for this color";
flags1024text = "[10] Use faster, unordered execution";
}
399
{
title = "Level Load";
prefix = "(399)";
flags1024text = "[10] Use faster, unordered execution";
}
}
@ -1977,7 +2035,7 @@ linedeftypes
title = "Set Tagged Sector's Floor Height/Texture";
prefix = "(400)";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Keep floor flat";
flags64text = "[6] Don't change floor texture";
}
401
@ -1985,6 +2043,7 @@ linedeftypes
title = "Set Tagged Sector's Ceiling Height/Texture";
prefix = "(401)";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't change ceiling texture";
}
402
@ -2075,7 +2134,7 @@ linedeftypes
prefix = "(403)";
flags2text = "[1] Trigger linedef executor";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Change floor flat";
flags64text = "[6] Change floor texture";
}
404
@ -2084,7 +2143,7 @@ linedeftypes
prefix = "(404)";
flags2text = "[1] Trigger linedef executor";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Change ceiling flat";
flags64text = "[6] Change ceiling texture";
}
405
@ -2646,7 +2705,7 @@ linedeftypes
502
{
title = "Scroll Tagged Wall";
title = "Scroll Tagged Walls";
prefix = "(502)";
flags128text = "[7] Use texture offsets";
flags256text = "[8] Scroll back side";
@ -2654,7 +2713,7 @@ linedeftypes
503
{
title = "Scroll Tagged Wall (Accelerative)";
title = "Scroll Tagged Walls (Accelerative)";
prefix = "(503)";
flags128text = "[7] Use texture offsets";
flags256text = "[8] Scroll back side";
@ -2662,7 +2721,7 @@ linedeftypes
504
{
title = "Scroll Tagged Wall (Displacement)";
title = "Scroll Tagged Walls (Displacement)";
prefix = "(504)";
flags128text = "[7] Use texture offsets";
flags256text = "[8] Scroll back side";
@ -2935,8 +2994,10 @@ linedeftypes
prefix = "(700)";
flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular";
slopeargs = 1;
copyslopeargs = 1;
}
701
@ -2945,8 +3006,10 @@ linedeftypes
prefix = "(701)";
flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular";
slopeargs = 2;
copyslopeargs = 4;
}
702
@ -2955,8 +3018,10 @@ linedeftypes
prefix = "(702)";
flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular";
slopeargs = 3;
copyslopeargs = 5;
}
703
@ -2965,8 +3030,10 @@ linedeftypes
prefix = "(703)";
flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular";
slopeargs = 9;
copyslopeargs = 8;
}
704
@ -2997,8 +3064,10 @@ linedeftypes
prefix = "(710)";
flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular";
slopeargs = 4;
copyslopeargs = 2;
}
711
@ -3007,8 +3076,10 @@ linedeftypes
prefix = "(711)";
flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular";
slopeargs = 8;
copyslopeargs = 8;
}
712
@ -3017,8 +3088,10 @@ linedeftypes
prefix = "(712)";
flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular";
slopeargs = 12;
copyslopeargs = 10;
}
713
@ -3027,8 +3100,10 @@ linedeftypes
prefix = "(713)";
flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular";
slopeargs = 6;
copyslopeargs = 6;
}
714
@ -3080,7 +3155,7 @@ linedeftypes
723
{
title = "Copy Backside Floor Slope from Line Tag";
prefix = "(720)";
prefix = "(723)";
slope = "copy";
slopeargs = 4;
}
@ -3088,7 +3163,7 @@ linedeftypes
724
{
title = "Copy Backside Ceiling Slope from Line Tag";
prefix = "(721)";
prefix = "(724)";
slope = "copy";
slopeargs = 8;
}
@ -3096,7 +3171,7 @@ linedeftypes
725
{
title = "Copy Backside Floor and Ceiling Slope from Line Tag";
prefix = "(722)";
prefix = "(725)";
slope = "copy";
slopeargs = 12;
}
@ -3158,7 +3233,7 @@ linedeftypes
transwall
{
title = "Translucent Wall";
title = "Translucent Walls";
900
{
@ -3219,6 +3294,192 @@ linedeftypes
title = "Fog Wall";
prefix = "(909)";
}
910
{
title = "100% Additive";
prefix = "(910)";
}
911
{
title = "90% Additive";
prefix = "(911)";
}
912
{
title = "80% Additive";
prefix = "(912)";
}
913
{
title = "70% Additive";
prefix = "(913)";
}
914
{
title = "60% Additive";
prefix = "(914)";
}
915
{
title = "50% Additive";
prefix = "(915)";
}
916
{
title = "40% Additive";
prefix = "(916)";
}
917
{
title = "30% Additive";
prefix = "(917)";
}
918
{
title = "20% Additive";
prefix = "(918)";
}
919
{
title = "10% Additive";
prefix = "(919)";
}
920
{
title = "100% Subtractive";
prefix = "(920)";
}
921
{
title = "90% Subtractive";
prefix = "(921)";
}
922
{
title = "80% Subtractive";
prefix = "(922)";
}
923
{
title = "70% Subtractive";
prefix = "(923)";
}
924
{
title = "60% Subtractive";
prefix = "(924)";
}
925
{
title = "50% Subtractive";
prefix = "(925)";
}
926
{
title = "40% Subtractive";
prefix = "(926)";
}
927
{
title = "30% Subtractive";
prefix = "(927)";
}
928
{
title = "20% Subtractive";
prefix = "(928)";
}
929
{
title = "10% Subtractive";
prefix = "(929)";
}
930
{
title = "100% Reverse Subtractive";
prefix = "(930)";
}
931
{
title = "90% Reverse Subtractive";
prefix = "(931)";
}
932
{
title = "80% Reverse Subtractive";
prefix = "(932)";
}
933
{
title = "70% Reverse Subtractive";
prefix = "(933)";
}
934
{
title = "60% Reverse Subtractive";
prefix = "(934)";
}
935
{
title = "50% Reverse Subtractive";
prefix = "(935)";
}
936
{
title = "40% Reverse Subtractive";
prefix = "(936)";
}
937
{
title = "30% Reverse Subtractive";
prefix = "(937)";
}
938
{
title = "20% Reverse Subtractive";
prefix = "(938)";
}
939
{
title = "10% Reverse Subtractive";
prefix = "(939)";
}
940
{
title = "Modulate";
prefix = "(940)";
}
}
}
@ -3574,6 +3835,7 @@ thingtypes
sprite = "ARCHA1";
width = 24;
height = 32;
flags8text = "[8] Don't jump away";
}
118
{
@ -3747,6 +4009,7 @@ thingtypes
sprite = "BUMBA1";
width = 16;
height = 32;
flags8text = "[8] Cannot move";
}
124
{
@ -3774,17 +4037,16 @@ thingtypes
{
title = "Egg Mobile";
sprite = "EGGMA1";
width = 24;
height = 76;
width = 36;
height = 84;
flags4text = "[4] End level on death";
flags8text = "[8] Alternate laser attack";
}
201
{
title = "Egg Slimer";
sprite = "EGGNA1";
width = 24;
height = 76;
width = 36;
height = 84;
flags4text = "[4] End level on death";
flags8text = "[8] Speed up when hit";
}
@ -3792,7 +4054,7 @@ thingtypes
{
title = "Sea Egg";
sprite = "EGGOA1";
width = 32;
width = 36;
height = 116;
flags4text = "[4] End level on death";
}
@ -3800,8 +4062,8 @@ thingtypes
{
title = "Egg Colosseum";
sprite = "EGGPA1";
width = 24;
height = 76;
width = 36;
height = 84;
flags4text = "[4] End level on death";
}
204
@ -3812,6 +4074,7 @@ thingtypes
height = 60;
flags1text = "[1] Grayscale mode";
flags4text = "[4] End level on death";
flags8text = "[8] Skip intro";
}
206
{
@ -5013,7 +5276,7 @@ thingtypes
width = 8;
height = 16;
hangs = 1;
angletext = "Dripping interval";
angletext = "Dripping delay";
fixedrotation = 1;
}
1003
@ -5355,6 +5618,8 @@ thingtypes
width = 20;
height = 72;
arrow = 1;
flags4text = "[4] Move right";
flags8text = "[8] Move left";
}
1128
{
@ -5507,6 +5772,7 @@ thingtypes
width = 24;
height = 63;
arrow = 1;
flags8text = "[8] Not pushable";
}
1217
{
@ -5642,6 +5908,7 @@ thingtypes
height = 32;
angletext = "Initial delay";
fixedrotation = 1;
hangs = 1;
flags8text = "[8] Double size";
}
1305
@ -6031,10 +6298,10 @@ thingtypes
}
1602
{
title = "Pian";
sprite = "NTPNALAR";
title = "Nightopian";
sprite = "NTPNA1";
width = 16;
height = 32;
height = 40;
}
}
@ -6613,6 +6880,20 @@ thingtypes
}
}
tutorial
{
color = 10; // Green
title = "Tutorial";
799
{
title = "Tutorial Plant";
sprite = "TUPFH0";
width = 40;
height = 144;
parametertext = "Start frame";
}
flickies
{
color = 10; // Green

View file

@ -264,10 +264,10 @@ mapformat_udmf
}
// LINEDEF RENDERSTYLES
/*linedefrenderstyles
linedefrenderstyles
{
include("SRB222_misc.cfg", "linedefrenderstyles");
}*/
}
// THING FLAGS
thingflags

View file

@ -1500,6 +1500,161 @@ doom
title = "Fog Wall";
prefix = "(909)";
}
910
{
title = "100% Additive";
prefix = "(910)";
}
911
{
title = "90% Additive";
prefix = "(911)";
}
912
{
title = "80% Additive";
prefix = "(912)";
}
913
{
title = "70% Additive";
prefix = "(913)";
}
914
{
title = "60% Additive";
prefix = "(914)";
}
915
{
title = "50% Additive";
prefix = "(915)";
}
916
{
title = "40% Additive";
prefix = "(916)";
}
917
{
title = "30% Additive";
prefix = "(917)";
}
918
{
title = "20% Additive";
prefix = "(918)";
}
919
{
title = "10% Additive";
prefix = "(919)";
}
920
{
title = "100% Subtractive";
prefix = "(920)";
}
921
{
title = "90% Subtractive";
prefix = "(921)";
}
922
{
title = "80% Subtractive";
prefix = "(922)";
}
923
{
title = "70% Subtractive";
prefix = "(923)";
}
924
{
title = "60% Subtractive";
prefix = "(924)";
}
925
{
title = "50% Subtractive";
prefix = "(925)";
}
926
{
title = "40% Subtractive";
prefix = "(926)";
}
927
{
title = "30% Subtractive";
prefix = "(927)";
}
928
{
title = "20% Subtractive";
prefix = "(928)";
}
929
{
title = "10% Subtractive";
prefix = "(929)";
}
930
{
title = "100% Reverse Subtractive";
prefix = "(930)";
}
931
{
title = "90% Reverse Subtractive";
prefix = "(931)";
}
932
{
title = "80% Reverse Subtractive";
prefix = "(932)";
}
933
{
title = "70% Reverse Subtractive";
prefix = "(933)";
}
934
{
title = "60% Reverse Subtractive";
prefix = "(934)";
}
935
{
title = "50% Reverse Subtractive";
prefix = "(935)";
}
936
{
title = "40% Reverse Subtractive";
prefix = "(936)";
}
937
{
title = "30% Reverse Subtractive";
prefix = "(937)";
}
938
{
title = "20% Reverse Subtractive";
prefix = "(938)";
}
939
{
title = "10% Reverse Subtractive";
prefix = "(939)";
}
940
{
title = "Modulate";
prefix = "(940)";
}
}
}

View file

@ -63,11 +63,15 @@ linedefflags_udmf
transfer = "Transfer Line";
}
/*linedefrenderstyles
linedefrenderstyles
{
translucent = "Translucent";
add = "Add";
subtract = "Subtract";
reversesubtract = "Reverse subtract";
modulate = "Modulate";
fog = "Fog";
}*/
}
sectorflags
{

View file

@ -2528,10 +2528,10 @@ dreamhill
}
1602
{
title = "Pian";
sprite = "NTPNALAR";
title = "Nightopian";
sprite = "NTPNA1";
width = 16;
height = 32;
height = 40;
}
}

8
objs/.gitignore vendored
View file

@ -1,8 +0,0 @@
#All folders
SRB2.res
depend.dep
depend.ped
*.o
#VC9 folder only
/VC9/Win32
/VC9/x64

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/VC/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/VC9/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,238 +1,14 @@
# SRB2 Core
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
# Core sources
set(SRB2_CORE_SOURCES
am_map.c
b_bot.c
command.c
comptime.c
console.c
d_clisrv.c
d_main.c
d_net.c
d_netcmd.c
d_netfil.c
dehacked.c
deh_soc.c
deh_lua.c
deh_tables.c
f_finale.c
f_wipe.c
filesrch.c
g_demo.c
g_game.c
g_input.c
hu_stuff.c
i_tcp.c
info.c
lzf.c
m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
m_cheat.c
m_cond.c
m_fixed.c
m_menu.c
m_misc.c
m_perfstats.c
m_queue.c
m_random.c
md5.c
mserv.c
http-mserv.c
s_sound.c
screen.c
sounds.c
st_stuff.c
#string.c
tables.c
v_video.c
w_wad.c
y_inter.c
z_zone.c
)
target_sourcefile(c)
target_sources(SRB2SDL2 PRIVATE comptime.c md5.c config.h.in)
set(SRB2_CORE_HEADERS
am_map.h
b_bot.h
byteptr.h
command.h
console.h
d_clisrv.h
d_event.h
d_main.h
d_net.h
d_netcmd.h
d_netfil.h
d_player.h
d_think.h
d_ticcmd.h
dehacked.h
deh_soc.h
deh_lua.h
deh_tables.h
doomdata.h
doomdef.h
doomstat.h
doomtype.h
endian.h
f_finale.h
fastcmp.h
filesrch.h
g_demo.h
g_game.h
g_input.h
g_state.h
hu_stuff.h
i_joy.h
i_net.h
i_sound.h
i_system.h
i_tcp.h
i_video.h
info.h
keys.h
lzf.h
m_aatree.h
m_anigif.h
m_argv.h
m_bbox.h
m_cheat.h
m_cond.h
m_dllist.h
m_fixed.h
m_menu.h
m_misc.h
m_perfstats.h
m_queue.h
m_random.h
m_swap.h
md5.h
mserv.h
p5prof.h
s_sound.h
screen.h
sounds.h
st_stuff.h
tables.h
v_video.h
w_wad.h
y_inter.h
z_zone.h
config.h.in
)
set(SRB2_CORE_RENDER_SOURCES
r_bsp.c
r_data.c
r_draw.c
r_main.c
r_plane.c
r_segs.c
r_skins.c
r_sky.c
r_splats.c
r_things.c
r_textures.c
r_patch.c
r_patchrotation.c
r_picformats.c
r_portal.c
r_bsp.h
r_data.h
r_defs.h
r_draw.h
r_local.h
r_main.h
r_plane.h
r_segs.h
r_skins.h
r_sky.h
r_splats.h
r_state.h
r_things.h
r_textures.h
r_patch.h
r_patchrotation.h
r_picformats.h
r_portal.h
)
set(SRB2_CORE_GAME_SOURCES
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_slopes.c
p_spec.c
p_telept.c
p_tick.c
p_user.c
taglist.c
p_local.h
p_maputl.h
p_mobj.h
p_polyobj.h
p_pspr.h
p_saveg.h
p_setup.h
p_slopes.h
p_spec.h
p_tick.h
taglist.h
)
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif()
prepend_sources(SRB2_CORE_SOURCES)
prepend_sources(SRB2_CORE_HEADERS)
prepend_sources(SRB2_CORE_RENDER_SOURCES)
prepend_sources(SRB2_CORE_GAME_SOURCES)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
set(SRB2_ASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s
)
set(SRB2_NASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/tmap_mmx.nas
${CMAKE_CURRENT_SOURCE_DIR}/tmap.nas
)
if(MSVC)
list(APPEND SRB2_NASM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tmap_vc.nas)
endif()
set(SRB2_NASM_OBJECTS
${CMAKE_CURRENT_BINARY_DIR}/tmap_mmx.obj
${CMAKE_CURRENT_BINARY_DIR}/tmap.obj
)
if(MSVC)
list(APPEND SRB2_NASM_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/tmap_vc.obj)
endif()
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
set(SRB2_ASM_SOURCES vid_copy.s)
set(SRB2_NASM_SOURCES tmap_mmx.nas tmap.nas)
### Configuration
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
@ -268,92 +44,7 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
endif()
set(SRB2_LUA_SOURCES
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_infolib.c
lua_maplib.c
lua_taglib.c
lua_mathlib.c
lua_mobjlib.c
lua_playerlib.c
lua_polyobjlib.c
lua_script.c
lua_skinlib.c
lua_thinkerlib.c
)
set(SRB2_LUA_HEADERS
lua_hook.h
lua_hud.h
lua_libs.h
lua_script.h
)
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
set(SRB2_BLUA_SOURCES
blua/lapi.c
blua/lauxlib.c
blua/lbaselib.c
blua/lcode.c
blua/ldebug.c
blua/ldo.c
blua/ldump.c
blua/lfunc.c
blua/lgc.c
blua/linit.c
blua/liolib.c
blua/llex.c
blua/lmem.c
blua/lobject.c
blua/lopcodes.c
blua/lparser.c
blua/lstate.c
blua/lstring.c
blua/lstrlib.c
blua/ltable.c
blua/ltablib.c
blua/ltm.c
blua/lundump.c
blua/lvm.c
blua/lzio.c
)
set(SRB2_BLUA_HEADERS
blua/lapi.h
blua/lauxlib.h
blua/lcode.h
blua/ldebug.h
blua/ldo.h
blua/lfunc.h
blua/lgc.h
blua/llex.h
blua/llimits.h
blua/lmem.h
blua/lobject.h
blua/lopcodes.h
blua/lparser.h
blua/lstate.h
blua/lstring.h
blua/ltable.h
blua/ltm.h
blua/lua.h
blua/luaconf.h
blua/lualib.h
blua/lundump.h
blua/lvm.h
blua/lzio.h
)
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
add_subdirectory(blua)
if(${SRB2_CONFIG_HAVE_GME})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
@ -369,7 +60,7 @@ if(${SRB2_CONFIG_HAVE_GME})
endif()
if(${GME_FOUND})
set(SRB2_HAVE_GME ON)
add_definitions(-DHAVE_LIBGME)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
else()
message(WARNING "You have specified that GME is available but it was not found.")
endif()
@ -389,7 +80,7 @@ if(${SRB2_CONFIG_HAVE_OPENMPT})
endif()
if(${OPENMPT_FOUND})
set(SRB2_HAVE_OPENMPT ON)
add_definitions(-DHAVE_OPENMPT)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
else()
message(WARNING "You have specified that OpenMPT is available but it was not found.")
endif()
@ -412,8 +103,7 @@ if(${SRB2_CONFIG_HAVE_MIXERX})
endif()
if(${MIXERX_FOUND})
set(SRB2_HAVE_MIXERX ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
add_definitions(-DHAVE_MIXERX)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXERX)
else()
message(WARNING "You have specified that SDL Mixer X is available but it was not found.")
endif()
@ -433,7 +123,7 @@ if(${SRB2_CONFIG_HAVE_ZLIB})
endif()
if(${ZLIB_FOUND})
set(SRB2_HAVE_ZLIB ON)
add_definitions(-DHAVE_ZLIB)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB)
else()
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2 may not compile correctly.")
endif()
@ -454,14 +144,9 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
endif()
if(${PNG_FOUND})
set(SRB2_HAVE_PNG ON)
add_definitions(-DHAVE_PNG)
add_definitions(-D_LARGEFILE64_SOURCE)
set(SRB2_PNG_SOURCES apng.c)
set(SRB2_PNG_HEADERS apng.h)
prepend_sources(SRB2_PNG_SOURCES)
prepend_sources(SRB2_PNG_HEADERS)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_PNG)
target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
target_sources(SRB2SDL2 PRIVATE apng.c)
else()
message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.")
endif()
@ -482,7 +167,7 @@ if(${SRB2_CONFIG_HAVE_CURL})
endif()
if(${CURL_FOUND})
set(SRB2_HAVE_CURL ON)
add_definitions(-DHAVE_CURL)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_CURL)
else()
message(WARNING "You have specified that CURL is available but it was not found. SRB2 may not compile correctly.")
endif()
@ -490,59 +175,19 @@ endif()
if(${SRB2_CONFIG_HAVE_THREADS})
set(SRB2_HAVE_THREADS ON)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/i_threads.h)
add_definitions(-DHAVE_THREADS)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
endif()
if(${SRB2_CONFIG_HWRENDER})
add_definitions(-DHWRENDER)
set(SRB2_HWRENDER_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c
)
set (SRB2_HWRENDER_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.h
)
set(SRB2_R_OPENGL_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.c
)
set(SRB2_R_OPENGL_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
)
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
add_subdirectory(hardware)
endif()
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
find_package(OpenGL)
if(${OPENGL_FOUND})
add_definitions(-DHWRENDER)
add_definitions(-DSTATIC_OPENGL)
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL)
else()
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
endif()
@ -563,12 +208,16 @@ if(${SRB2_CONFIG_USEASM})
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)
add_definitions(-DUSEASM)
target_compile_definitions(SRB2SDL2 PRIVATE -DUSEASM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -mfpmath=sse")
target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES}
${SRB2_NASM_SOURCES})
else()
set(SRB2_USEASM OFF)
add_definitions(-DNONX86 -DNORUSEASM)
target_compile_definitions(SRB2SDL2 PRIVATE -DNONX86 -DNORUSEASM)
endif()
# Targets
@ -606,7 +255,7 @@ endif()
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-trigraphs)
add_definitions(-DCMAKECONFIG)
target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG)
#add_library(SRB2Core STATIC
# ${SRB2_CORE_SOURCES}

File diff suppressed because it is too large Load diff

View file

@ -1,478 +0,0 @@
# vim: ft=make
#
# Makefile.cfg for SRB2
#
#
# GNU compiler & tools' flags
# and other things
#
# See the following variable don't start with 'GCC'. This is
# to avoid a false positive with the version detection...
SUPPORTED_GCC_VERSIONS:=\
101 102\
91 92 93\
81 82 83 84\
71 72 73 74 75\
61 62 63 64\
51 52 53 54 55\
40 41 42 43 44 45 46 47 48 49
LATEST_GCC_VERSION=10.2
# gcc or g++
ifdef PREFIX
CC=$(PREFIX)-gcc
CXX=$(PREFIX)-g++
OBJCOPY=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump
STRIP=$(PREFIX)-strip
WINDRES=$(PREFIX)-windres
else
OBJCOPY=objcopy
OBJDUMP=objdump
STRIP=strip
WINDRES=windres
endif
# because Apple screws with us on this
# need to get bintools from homebrew
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
endif
# Automatically set version flag, but not if one was manually set
# And don't bother if this is a clean only run
ifeq (,$(filter GCC% CLEANONLY,$(.VARIABLES)))
version:=$(shell $(CC) --version)
# check if this is in fact GCC
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
version:=$(shell $(CC) -dumpversion)
# Turn version into words of major, minor
v:=$(subst ., ,$(version))
# concat. major minor
v:=$(word 1,$(v))$(word 2,$(v))
# If this version is not in the list, default to the latest supported
ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS)))
define line =
Your compiler version, GCC $(version), is not supported by the Makefile.
The Makefile will assume GCC $(LATEST_GCC_VERSION).))
endef
$(call print,$(line))
GCC$(subst .,,$(LATEST_GCC_VERSION))=1
else
$(call print,Detected GCC $(version) (GCC$(v)))
GCC$(v)=1
endif
endif
endif
ifdef GCC102
GCC101=1
endif
ifdef GCC101
GCC93=1
endif
ifdef GCC93
GCC92=1
endif
ifdef GCC92
GCC91=1
endif
ifdef GCC91
GCC84=1
endif
ifdef GCC84
GCC83=1
endif
ifdef GCC83
GCC82=1
endif
ifdef GCC82
GCC81=1
endif
ifdef GCC81
GCC75=1
endif
ifdef GCC75
GCC74=1
endif
ifdef GCC74
GCC73=1
endif
ifdef GCC73
GCC72=1
endif
ifdef GCC72
GCC71=1
endif
ifdef GCC71
GCC64=1
endif
ifdef GCC64
GCC63=1
endif
ifdef GCC63
GCC62=1
endif
ifdef GCC62
GCC61=1
endif
ifdef GCC61
GCC55=1
endif
ifdef GCC55
GCC54=1
endif
ifdef GCC54
GCC53=1
endif
ifdef GCC53
GCC52=1
endif
ifdef GCC52
GCC51=1
endif
ifdef GCC51
GCC49=1
endif
ifdef GCC49
GCC48=1
endif
ifdef GCC48
GCC47=1
endif
ifdef GCC47
GCC46=1
endif
ifdef GCC46
GCC45=1
endif
ifdef GCC45
GCC44=1
endif
ifdef GCC44
GCC43=1
endif
ifdef GCC43
GCC42=1
endif
ifdef GCC42
GCC41=1
endif
ifdef GCC41
GCC40=1
VCHELP=1
endif
ifdef GCC295
GCC29=1
endif
OLDWFLAGS:=$(WFLAGS)
# -W -Wno-unused
WFLAGS=-Wall -Wno-trigraphs
ifndef GCC295
#WFLAGS+=-Wno-packed
endif
ifndef RELAXWARNINGS
WFLAGS+=-W
#WFLAGS+=-Wno-sign-compare
ifndef GCC295
WFLAGS+=-Wno-div-by-zero
endif
#WFLAGS+=-Wsystem-headers
WFLAGS+=-Wfloat-equal
#WFLAGS+=-Wtraditional
ifdef VCHELP
WFLAGS+=-Wdeclaration-after-statement
WFLAGS+=-Wno-error=declaration-after-statement
endif
WFLAGS+=-Wundef
ifndef GCC295
WFLAGS+=-Wendif-labels
endif
ifdef GCC41
WFLAGS+=-Wshadow
endif
#WFLAGS+=-Wlarger-than-%len%
WFLAGS+=-Wpointer-arith -Wbad-function-cast
ifdef GCC45
#WFLAGS+=-Wc++-compat
endif
WFLAGS+=-Wcast-qual
ifndef NOCASTALIGNWARN
WFLAGS+=-Wcast-align
endif
WFLAGS+=-Wwrite-strings
ifndef ERRORMODE
#WFLAGS+=-Wconversion
ifdef GCC43
#WFLAGS+=-Wno-sign-conversion
endif
endif
WFLAGS+=-Wsign-compare
ifdef GCC91
WFLAGS+=-Wno-error=address-of-packed-member
endif
ifdef GCC45
WFLAGS+=-Wlogical-op
endif
WFLAGS+=-Waggregate-return
ifdef HAIKU
ifdef GCC41
#WFLAGS+=-Wno-attributes
endif
endif
#WFLAGS+=-Wstrict-prototypes
ifdef GCC40
WFLAGS+=-Wold-style-definition
endif
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
ifdef GCC40
WFLAGS+=-Wmissing-field-initializers
endif
WFLAGS+=-Wmissing-noreturn
#WFLAGS+=-Wmissing-format-attribute
#WFLAGS+=-Wno-multichar
#WFLAGS+=-Wno-deprecated-declarations
#WFLAGS+=-Wpacked
#WFLAGS+=-Wpadded
#WFLAGS+=-Wredundant-decls
WFLAGS+=-Wnested-externs
#WFLAGS+=-Wunreachable-code
WFLAGS+=-Winline
ifdef GCC43
WFLAGS+=-funit-at-a-time
WFLAGS+=-Wlogical-op
endif
ifndef GCC295
WFLAGS+=-Wdisabled-optimization
endif
endif
WFLAGS+=-Wformat-y2k
ifdef GCC71
WFLAGS+=-Wno-error=format-overflow=2
endif
WFLAGS+=-Wformat-security
ifndef GCC29
#WFLAGS+=-Winit-self
endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
ifdef NOLDWARNING
LDFLAGS+=-Wl,--as-needed
endif
ifdef ERRORMODE
WFLAGS+=-Werror
endif
WFLAGS+=$(OLDWFLAGS)
ifdef GCC43
#WFLAGS+=-Wno-error=clobbered
endif
ifdef GCC44
WFLAGS+=-Wno-error=array-bounds
endif
ifdef GCC46
WFLAGS+=-Wno-error=suggest-attribute=noreturn
endif
ifdef GCC54
WFLAGS+=-Wno-logical-op -Wno-error=logical-op
endif
ifdef GCC61
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
endif
ifdef GCC71
WFLAGS+=-Wimplicit-fallthrough=4
endif
ifdef GCC81
WFLAGS+=-Wno-error=format-overflow
WFLAGS+=-Wno-error=stringop-truncation
WFLAGS+=-Wno-error=stringop-overflow
WFLAGS+=-Wno-format-overflow
WFLAGS+=-Wno-stringop-truncation
WFLAGS+=-Wno-stringop-overflow
WFLAGS+=-Wno-error=multistatement-macros
endif
#indicate platform and what interface use with
ifndef LINUX
ifndef FREEBSD
ifndef CYGWIN32
ifndef MINGW
ifndef MINGW64
ifndef SDL
ifndef DUMMY
$(error No interface or platform flag defined)
endif
endif
endif
endif
endif
endif
endif
#determine the interface directory (where you put all i_*.c)
i_net_o=$(OBJDIR)/i_net.o
i_system_o=$(OBJDIR)/i_system.o
i_sound_o=$(OBJDIR)/i_sound.o
i_main_o=$(OBJDIR)/i_main.o
#set OBJDIR and BIN's starting place
OBJDIR=../objs
BIN=../bin
DEPDIR=../dep
#Nasm ASM and rm
ifdef YASM
NASM?=yasm
else
NASM?=nasm
endif
REMOVE?=rm -f
MKDIR?=mkdir -p
GZIP?=gzip
GZIP_OPTS?=-9 -f -n
GZIP_OPT2=$(GZIP_OPTS) --rsyncable
UPX?=upx
UPX_OPTS?=--best --preserve-build-id
ifndef ECHO
UPX_OPTS+=-q
endif
#Interface Setup
ifdef DUMMY
INTERFACE=dummy
OBJDIR:=$(OBJDIR)/dummy
BIN:=$(BIN)/dummy
DEPDIR:=$(DEPDIR)/dummy
else
ifdef LINUX
NASMFORMAT=elf -DLINUX
SDL=1
ifdef LINUX64
OBJDIR:=$(OBJDIR)/Linux64
BIN:=$(BIN)/Linux64
DEPDIR:=$(DEPDIR)/Linux64
else
OBJDIR:=$(OBJDIR)/Linux
BIN:=$(BIN)/Linux
DEPDIR:=$(DEPDIR)/Linux
endif
else
ifdef FREEBSD
INTERFACE=sdl
NASMFORMAT=elf -DLINUX
SDL=1
OBJDIR:=$(OBJDIR)/FreeBSD
BIN:=$(BIN)/FreeBSD
DEPDIR:=$(DEPDIR)/Linux
else
ifdef SOLARIS
INTERFACE=sdl
NASMFORMAT=elf -DLINUX
SDL=1
OBJDIR:=$(OBJDIR)/Solaris
BIN:=$(BIN)/Solaris
DEPDIR:=$(DEPDIR)/Solaris
else
ifdef CYGWIN32
INTERFACE=sdl
NASMFORMAT=win32
SDL=1
OBJDIR:=$(OBJDIR)/cygwin
BIN:=$(BIN)/Cygwin
DEPDIR:=$(DEPDIR)/Cygwin
else
ifdef MINGW64
#NASMFORMAT=win64
SDL=1
OBJDIR:=$(OBJDIR)/Mingw64
BIN:=$(BIN)/Mingw64
DEPDIR:=$(DEPDIR)/Mingw64
else
ifdef MINGW
NASMFORMAT=win32
SDL=1
OBJDIR:=$(OBJDIR)/Mingw
BIN:=$(BIN)/Mingw
DEPDIR:=$(DEPDIR)/Mingw
endif
endif
endif
endif
endif
endif
endif
ifdef ARCHNAME
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
BIN:=$(BIN)/$(ARCHNAME)
DEPDIR:=$(DEPDIR)/$(ARCHNAME)
endif
OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)
ifdef SDL
INTERFACE=sdl
OBJDIR:=$(OBJDIR)/SDL
DEPDIR:=$(DEPDIR)/SDL
endif
ifndef DUMMY
ifdef DEBUGMODE
OBJDIR:=$(OBJDIR)/Debug
BIN:=$(BIN)/Debug
DEPDIR:=$(DEPDIR)/Debug
else
OBJDIR:=$(OBJDIR)/Release
BIN:=$(BIN)/Release
DEPDIR:=$(DEPDIR)/Release
endif
endif

107
src/Makefile.d/detect.mk Normal file
View file

@ -0,0 +1,107 @@
#
# Detect the host system and compiler version.
#
# Previously featured:\
PANDORA\
HAIKU\
DUMMY\
DJGPPDOS\
SOLARIS\
MACOSX\
all_systems:=\
LINUX64\
MINGW64\
MINGW\
UNIX\
LINUX\
FREEBSD\
SDL\
# check for user specified system
ifeq (,$(filter $(all_systems),$(.VARIABLES)))
ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
_m=Detected a Windows system,\
compiling for 32-bit MinGW SDL...)
$(call Print,$(_m))
# go for a 32-bit sdl mingw exe by default
MINGW:=1
else # if you on the *nix
system:=$(shell uname -s)
ifeq ($(system),Linux)
new_system:=LINUX
else
$(error \
Could not automatically detect your system,\
try specifying a system manually)
endif
ifeq ($(shell getconf LONG_BIT),64)
system+=64-bit
new_system:=$(new_system)64
endif
$(call Print,Detected $(system) ($(new_system))...)
$(new_system):=1
endif
endif
# This must have high to low order.
gcc_versions:=\
102 101\
93 92 91\
84 83 82 81\
75 74 73 72 71\
64 63 62 61\
55 54 53 52 51\
49 48 47 46 45 44 43 42 41 40
latest_gcc_version:=10.2
# Automatically set version flag, but not if one was
# manually set. And don't bother if this is a clean only
# run.
ifeq (,$(call Wildvar,GCC% destructive))
# can't use $(CC) --version here since that uses argv[0] to display the name
# also gcc outputs the information to stderr, so I had to do 2>&1
# this program really doesn't like identifying itself
version:=$(shell $(CC) -v 2>&1)
# check if this is in fact GCC
ifneq (,$(findstring gcc version,$(version)))
# in stark contrast to the name, gcc will give me a nicely formatted version number for free
version:=$(shell $(CC) -dumpfullversion)
# Turn version into words of major, minor
v:=$(subst ., ,$(version))
# concat. major minor
v:=$(word 1,$(v))$(word 2,$(v))
# If this version is not in the list,
# default to the latest supported
ifeq (,$(filter $(v),$(gcc_versions)))
define line =
Your compiler version, GCC $(version), \
is not supported by the Makefile.
The Makefile will assume GCC $(latest_gcc_version).
endef
$(call Print,$(line))
GCC$(subst .,,$(latest_gcc_version)):=1
else
$(call Print,Detected GCC $(version) (GCC$(v)))
GCC$(v):=1
endif
endif
endif

View file

@ -0,0 +1,75 @@
#
# Makefile for feature flags.
#
passthru_opts+=\
NONET NO_IPV6 NOHW NOMD5 NOPOSTPROCESSING\
MOBJCONSISTANCY PACKETDROP ZDEBUG\
HAVE_MINIUPNPC\
# build with debugging information
ifdef DEBUGMODE
PACKETDROP=1
opts+=-DPARANOIA -DRANGECHECK
endif
ifndef NOHW
opts+=-DHWRENDER
sources+=$(call List,hardware/Sourcefile)
endif
ifndef NOASM
ifndef NONX86
sources+=tmap.nas tmap_mmx.nas
opts+=-DUSEASM
endif
endif
ifndef NOMD5
sources+=md5.c
endif
ifndef NOZLIB
ifndef NOPNG
ifdef PNG_PKGCONFIG
$(eval $(call Use_pkg_config,PNG_PKGCONFIG))
else
PNG_CONFIG?=$(call Prefix,libpng-config)
$(eval $(call Configure,PNG,$(PNG_CONFIG) \
$(if $(PNG_STATIC),--static),,--ldflags))
endif
ifdef LINUX
opts+=-D_LARGEFILE64_SOURCE
endif
opts+=-DHAVE_PNG
sources+=apng.c
endif
endif
ifndef NONET
ifndef NOCURL
CURLCONFIG?=curl-config
$(eval $(call Configure,CURL,$(CURLCONFIG)))
opts+=-DHAVE_CURL
endif
endif
ifdef HAVE_MINIUPNPC
libs+=-lminiupnpc
endif
# (Valgrind is a memory debugger.)
ifdef VALGRIND
VALGRIND_PKGCONFIG?=valgrind
$(eval $(call Use_pkg_config,VALGRIND))
ZDEBUG=1
opts+=-DHAVE_VALGRIND
endif
default_packages:=\
GME/libgme/LIBGME\
OPENMPT/libopenmpt/LIBOPENMPT\
ZLIB/zlib\
$(foreach p,$(default_packages),\
$(eval $(call Check_pkg_config,$(p))))

42
src/Makefile.d/nix.mk Normal file
View file

@ -0,0 +1,42 @@
#
# Makefile options for unices (linux, bsd...)
#
EXENAME?=lsdl2srb2
opts+=-DUNIXCOMMON -DLUA_USE_POSIX
# Use -rdynamic so a backtrace log shows function names
# instead of addresses
libs+=-lm -rdynamic
ifndef nasm_format
nasm_format:=elf -DLINUX
endif
ifndef NOHW
opts+=-I/usr/X11R6/include
libs+=-L/usr/X11R6/lib
endif
SDL=1
# In common usage.
ifdef LINUX
libs+=-lrt
passthru_opts+=NOTERMIOS
endif
# Tested by Steel, as of release 2.2.8.
ifdef FREEBSD
opts+=-I/usr/X11R6/include -DLINUX -DFREEBSD
libs+=-L/usr/X11R6/lib -lipx -lkvm
endif
# FIXME: UNTESTED
#ifdef SOLARIS
#NOIPX=1
#NOASM=1
#opts+=-I/usr/local/include -I/opt/sfw/include \
# -DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
#libs+=-L/opt/sfw/lib -lsocket -lnsl
#endif

16
src/Makefile.d/old.mk Normal file
View file

@ -0,0 +1,16 @@
#
# Warn about old build directories and offer to purge.
#
_old:=$(wildcard $(addprefix ../bin/,FreeBSD Linux \
Linux64 Mingw Mingw64 SDL dummy) ../objs ../dep)
ifdef _old
$(foreach v,$(_old),$(info $(abspath $(v))))
$(info )
$(info These directories are no longer\
required and should be removed.)
$(info You may remove them manually or\
by using 'make distclean')
$(error )
endif

View file

@ -0,0 +1,69 @@
#
# Platform specific options.
#
PKG_CONFIG?=pkg-config
ifdef WINDOWSHELL
rmrf=-2>NUL DEL /S /Q
mkdir=-2>NUL MD
cat=TYPE
else
rmrf=rm -rf
mkdir=mkdir -p
cat=cat
endif
ifdef LINUX64
LINUX=1
endif
ifdef MINGW64
MINGW=1
endif
ifdef LINUX
UNIX=1
ifdef LINUX64
NONX86=1
# LINUX64 does not imply X86_64=1;
# could mean ARM64 or Itanium
platform=linux/64
else
platform=linux
endif
else ifdef FREEBSD
UNIX=1
platform=freebsd
else ifdef SOLARIS # FIXME: UNTESTED
UNIX=1
platform=solaris
else ifdef CYGWIN32 # FIXME: UNTESTED
nasm_format=win32
platform=cygwin
else ifdef MINGW
ifdef MINGW64
NONX86=1
NOASM=1
# MINGW64 should not necessarily imply X86_64=1,
# but we make that assumption elsewhere
# Once that changes, remove this
X86_64=1
platform=mingw/64
else
platform=mingw
endif
include Makefile.d/win32.mk
endif
ifdef platform
makedir:=$(makedir)/$(platform)
endif
ifdef UNIX
include Makefile.d/nix.mk
endif
ifdef SDL
include Makefile.d/sdl.mk
endif

79
src/Makefile.d/sdl.mk Normal file
View file

@ -0,0 +1,79 @@
#
# Makefile options for SDL2 backend.
#
#
# SDL...., *looks at Alam*, THIS IS A MESS!
#
# ...a little bird flexes its muscles...
#
makedir:=$(makedir)/SDL
sources+=$(call List,sdl/Sourcefile)
opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
# FIXME: UNTESTED
#ifdef PANDORA
#include sdl/SRB2Pandora/Makefile.cfg
#endif #ifdef PANDORA
# FIXME: UNTESTED
#ifdef CYGWIN32
#include sdl/MakeCYG.cfg
#endif #ifdef CYGWIN32
ifndef NOHW
sources+=sdl/ogl_sdl.c
endif
ifdef NOMIXER
sources+=sdl/sdl_sound.c
else
opts+=-DHAVE_MIXER
sources+=sdl/mixer_sound.c
ifdef HAVE_MIXERX
opts+=-DHAVE_MIXERX
libs+=-lSDL2_mixer_ext
else
libs+=-lSDL2_mixer
endif
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c
endif
ifdef SDL_PKGCONFIG
$(eval $(call Use_pkg_config,SDL))
else
SDL_CONFIG?=$(call Prefix,sdl2-config)
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
$(if $(STATIC),--static-libs,--libs))
$(eval $(call Propogate_flags,SDL))
endif
# use the x86 asm code
ifndef CYGWIN32
ifndef NOASM
USEASM=1
endif
endif
ifdef MINGW
ifndef NOSDLMAIN
SDLMAIN=1
endif
endif
ifdef SDLMAIN
opts+=-DSDLMAIN
else
ifdef MINGW
opts+=-Umain
libs+=-mconsole
endif
endif

93
src/Makefile.d/util.mk Normal file
View file

@ -0,0 +1,93 @@
#
# Utility macros for the rest of the Makefiles.
#
Ifnot=$(if $(1),$(3),$(2))
Ifndef=$(call Ifnot,$($(1)),$(2),$(3))
# Match and expand a list of variables by pattern.
Wildvar=$(foreach v,$(filter $(1),$(.VARIABLES)),$($(v)))
# Read a list of words from file and prepend each with the
# directory of the file.
_cat=$(shell $(cat) $(call Windows_path,$(1)))
List=$(addprefix $(dir $(1)),$(call _cat,$(1)))
# Convert path separators to backslash on Windows.
Windows_path=$(if $(WINDOWSHELL),$(subst /,\,$(1)),$(1))
define Propogate_flags =
opts+=$$($(1)_CFLAGS)
libs+=$$($(1)_LDFLAGS)
endef
# Set library's _CFLAGS and _LDFLAGS from some command.
# Automatically propogates the flags too.
# 1: variable prefix (e.g. CURL)
# 2: start of command (e.g. curl-config)
# --- optional ----
# 3: CFLAGS command arguments, default '--cflags'
# 4: LDFLAGS command arguments, default '--libs'
# 5: common command arguments at the end of command
define Configure =
$(1)_CFLAGS?=$$(shell $(2) $(or $(3),--cflags) $(5))
$(1)_LDFLAGS?=$$(shell $(2) $(or $(4),--libs) $(5))
$(call Propogate_flags,$(1))
endef
# Configure library with pkg-config. The package name is
# taken from a _PKGCONFIG variable.
# 1: variable prefix
#
# LIBGME_PKGCONFIG=libgme
# $(eval $(call Use_pkg_config,LIBGME))
define Use_pkg_config =
$(call Configure,$(1),$(PKG_CONFIG),,,$($(1)_PKGCONFIG))
endef
# Check disabling flag and configure package in one step
# according to delimited argument.
# (There is only one argument, but it split by slash.)
# 1/: short form library name (uppercase). This is
# prefixed with 'NO' and 'HAVE_'. E.g. NOGME, HAVE_GME
# /2: package name (e.g. libgme)
# /3: variable prefix
#
# The following example would check if NOGME is not
# defined before attempting to define LIBGME_CFLAGS and
# LIBGME_LDFLAGS as with Use_pkg_config.
#
# $(eval $(call Check_pkg_config,GME/libgme/LIBGME))
define Check_pkg_config =
_p:=$(subst /, ,$(1))
_v1:=$$(word 1,$$(_p))
_v2:=$$(or $$(word 3,$$(_p)),$$(_v1))
ifndef NO$$(_v1)
$$(_v2)_PKGCONFIG?=$$(word 2,$$(_p))
$$(eval $$(call Use_pkg_config,$$(_v2)))
opts+=-DHAVE_$$(_v1)
endif
endef
# $(call Prefix,gcc)
Prefix=$(if $(PREFIX),$(PREFIX)-)$(1)
Echo=
Echo_name=
Print=
ifndef SILENT
Echo=@echo $(1)
ifndef ECHO
ifndef NOECHOFILENAMES
Echo_name=$(call Echo,-- $(1) ...)
endif
endif
ifndef MAKE_RESTARTS
ifndef destructive
Print=$(info $(1))
endif
endif
endif
.=$(call Ifndef,ECHO,@)

175
src/Makefile.d/versions.mk Normal file
View file

@ -0,0 +1,175 @@
#
# Flags to put a sock in GCC!
#
# See the versions list in detect.mk
# This will define all version flags going backward.
# Yes, it's magic.
define _predecessor =
ifdef GCC$(firstword $(1))
GCC$(lastword $(1)):=1
endif
endef
_n:=$(words $(gcc_versions))
$(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
$(addprefix =,$(wordlist 2,$(_n),$(gcc_versions)))),\
$(and $(findstring =,$(v)),\
$(eval $(call _predecessor,$(subst =, ,$(v))))))
# -W -Wno-unused
WFLAGS:=-Wall -Wno-trigraphs
ifndef GCC295
#WFLAGS+=-Wno-packed
endif
ifndef RELAXWARNINGS
WFLAGS+=-W
#WFLAGS+=-Wno-sign-compare
ifndef GCC295
WFLAGS+=-Wno-div-by-zero
endif
#WFLAGS+=-Wsystem-headers
WFLAGS+=-Wfloat-equal
#WFLAGS+=-Wtraditional
WFLAGS+=-Wundef
ifndef GCC295
WFLAGS+=-Wendif-labels
endif
ifdef GCC41
WFLAGS+=-Wshadow
endif
#WFLAGS+=-Wlarger-than-%len%
WFLAGS+=-Wpointer-arith -Wbad-function-cast
ifdef GCC45
#WFLAGS+=-Wc++-compat
endif
WFLAGS+=-Wcast-qual
ifndef NOCASTALIGNWARN
WFLAGS+=-Wcast-align
endif
WFLAGS+=-Wwrite-strings
ifndef ERRORMODE
#WFLAGS+=-Wconversion
ifdef GCC43
#WFLAGS+=-Wno-sign-conversion
endif
endif
WFLAGS+=-Wsign-compare
ifdef GCC91
WFLAGS+=-Wno-error=address-of-packed-member
endif
ifdef GCC45
WFLAGS+=-Wlogical-op
endif
WFLAGS+=-Waggregate-return
ifdef HAIKU
ifdef GCC41
#WFLAGS+=-Wno-attributes
endif
endif
#WFLAGS+=-Wstrict-prototypes
ifdef GCC40
WFLAGS+=-Wold-style-definition
endif
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
ifdef GCC40
WFLAGS+=-Wmissing-field-initializers
endif
WFLAGS+=-Wmissing-noreturn
#WFLAGS+=-Wmissing-format-attribute
#WFLAGS+=-Wno-multichar
#WFLAGS+=-Wno-deprecated-declarations
#WFLAGS+=-Wpacked
#WFLAGS+=-Wpadded
#WFLAGS+=-Wredundant-decls
WFLAGS+=-Wnested-externs
#WFLAGS+=-Wunreachable-code
WFLAGS+=-Winline
ifdef GCC43
WFLAGS+=-funit-at-a-time
WFLAGS+=-Wlogical-op
endif
ifndef GCC295
WFLAGS+=-Wdisabled-optimization
endif
endif
WFLAGS+=-Wformat-y2k
ifdef GCC71
WFLAGS+=-Wno-error=format-overflow=2
endif
WFLAGS+=-Wformat-security
ifndef GCC29
#WFLAGS+=-Winit-self
endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
ifdef NOLDWARNING
LDFLAGS+=-Wl,--as-needed
endif
ifdef ERRORMODE
WFLAGS+=-Werror
endif
ifdef GCC43
#WFLAGS+=-Wno-error=clobbered
endif
ifdef GCC44
WFLAGS+=-Wno-error=array-bounds
endif
ifdef GCC46
WFLAGS+=-Wno-error=suggest-attribute=noreturn
endif
ifdef GCC54
WFLAGS+=-Wno-logical-op -Wno-error=logical-op
endif
ifdef GCC61
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
endif
ifdef GCC71
WFLAGS+=-Wimplicit-fallthrough=4
endif
ifdef GCC81
WFLAGS+=-Wno-error=format-overflow
WFLAGS+=-Wno-error=stringop-truncation
WFLAGS+=-Wno-error=stringop-overflow
WFLAGS+=-Wno-format-overflow
WFLAGS+=-Wno-stringop-truncation
WFLAGS+=-Wno-stringop-overflow
WFLAGS+=-Wno-error=multistatement-macros
endif
ifdef NONX86
ifdef X86_64 # yeah that SEEMS contradictory
opts+=-march=nocona
endif
else
ifndef GCC29
opts+=-msse3 -mfpmath=sse
else
opts+=-mpentium
endif
endif
ifdef DEBUGMODE
ifdef GCC48
opts+=-Og
else
opts+=O0
endif
endif
ifdef VALGRIND
ifdef GCC46
WFLAGS+=-Wno-error=unused-but-set-variable
WFLAGS+=-Wno-unused-but-set-variable
endif
endif
# Lua
ifdef GCC43
ifndef GCC44
WFLAGS+=-Wno-logical-op
endif
endif

104
src/Makefile.d/win32.mk Normal file
View file

@ -0,0 +1,104 @@
#
# Mingw, if you don't know, that's Win32/Win64
#
ifndef MINGW64
EXENAME?=srb2win.exe
else
EXENAME?=srb2win64.exe
endif
# disable dynamicbase if under msys2
ifdef MSYSTEM
libs+=-Wl,--disable-dynamicbase
endif
sources+=win32/Srb2win.rc
opts+=-DSTDC_HEADERS
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
nasm_format:=win32
SDL=1
ifndef NOHW
opts+=-DUSE_WGL_SWAP
endif
ifdef MINGW64
libs+=-lws2_32
else
ifdef NO_IPV6
libs+=-lwsock32
else
libs+=-lws2_32
endif
endif
ifndef NONET
ifndef MINGW64 # miniupnc is broken with MINGW64
opts+=-I../libs -DSTATIC_MINIUPNPC
libs+=-L../libs/miniupnpc/mingw$(32) -lws2_32 -liphlpapi
endif
endif
ifndef MINGW64
32=32
x86=x86
i686=i686
else
32=64
x86=x86_64
i686=x86_64
endif
mingw:=$(i686)-w64-mingw32
define _set =
$(1)_CFLAGS?=$($(1)_opts)
$(1)_LDFLAGS?=$($(1)_libs)
endef
lib:=../libs/gme
LIBGME_opts:=-I$(lib)/include
LIBGME_libs:=-L$(lib)/win$(32) -lgme
$(eval $(call _set,LIBGME))
lib:=../libs/libopenmpt
LIBOPENMPT_opts:=-I$(lib)/inc
LIBOPENMPT_libs:=-L$(lib)/lib/$(x86)/mingw -lopenmpt
$(eval $(call _set,LIBOPENMPT))
ifndef NOMIXERX
HAVE_MIXERX=1
lib:=../libs/SDLMixerX/$(mingw)
else
lib:=../libs/SDL2_mixer/$(mingw)
endif
mixer_opts:=-I$(lib)/include/SDL2
mixer_libs:=-L$(lib)/lib
lib:=../libs/SDL2/$(mingw)
SDL_opts:=-I$(lib)/include/SDL2\
$(mixer_opts) -Dmain=SDL_main
SDL_libs:=-L$(lib)/lib $(mixer_libs)\
-lmingw32 -lSDL2main -lSDL2 -mwindows
$(eval $(call _set,SDL))
lib:=../libs/zlib
ZLIB_opts:=-I$(lib)
ZLIB_libs:=-L$(lib)/win32 -lz$(32)
$(eval $(call _set,ZLIB))
ifndef PNG_CONFIG
lib:=../libs/libpng-src
PNG_opts:=-I$(lib)
PNG_libs:=-L$(lib)/projects -lpng$(32)
$(eval $(call _set,PNG))
endif
lib:=../libs/curl
CURL_opts:=-I$(lib)/include
CURL_libs:=-L$(lib)/lib$(32) -lcurl
$(eval $(call _set,CURL))

98
src/Sourcefile Normal file
View file

@ -0,0 +1,98 @@
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
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_main.c
r_plane.c
r_segs.c
r_skins.c
r_sky.c
r_splats.c
r_things.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
vid_copy.s
b_bot.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_inputlib.c

View file

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
// Copyright (C) 1999-2022 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -458,7 +458,7 @@ boolean AM_Responder(event_t *ev)
{
if (!automapactive)
{
if (ev->type == ev_keydown && ev->data1 == AM_TOGGLEKEY)
if (ev->type == ev_keydown && ev->key == AM_TOGGLEKEY)
{
//faB: prevent alt-tab in win32 version to activate automap just before
// minimizing the app; doesn't do any harm to the DOS version
@ -473,7 +473,7 @@ boolean AM_Responder(event_t *ev)
else if (ev->type == ev_keydown)
{
rc = true;
switch (ev->data1)
switch (ev->key)
{
case AM_PANRIGHTKEY: // pan right
if (!followplayer)
@ -550,7 +550,7 @@ boolean AM_Responder(event_t *ev)
else if (ev->type == ev_keyup)
{
rc = false;
switch (ev->data1)
switch (ev->key)
{
case AM_PANRIGHTKEY:
if (!followplayer)

View file

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
// Copyright (C) 1999-2022 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.

View file

@ -1,5 +1,5 @@
/*
Copyright 2019-2021, James R.
Copyright 2019-2022, James R.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
Copyright 2019-2021, James R.
Copyright 2019-2022, James R.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
// Copyright (C) 1999-2022 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz.
// Copyright (C) 2011-2021 by Sonic Team Junior.
// Copyright (C) 2011-2022 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -17,30 +17,45 @@
#include "p_local.h"
#include "b_bot.h"
#include "lua_hook.h"
#include "i_system.h" // I_BaseTiccmd
// If you want multiple bots, variables like this will
// have to be stuffed in something accessible through player_t.
static boolean lastForward = false;
static boolean lastBlocked = false;
static boolean blocked = false;
static boolean jump_last = false;
static boolean spin_last = false;
static UINT8 anxiety = 0;
static boolean panic = false;
static UINT8 flymode = 0;
static boolean spinmode = false;
static boolean thinkfly = false;
static inline void B_ResetAI(void)
void B_UpdateBotleader(player_t *player)
{
jump_last = false;
spin_last = false;
anxiety = 0;
panic = false;
flymode = 0;
spinmode = false;
thinkfly = false;
UINT32 i;
fixed_t dist;
fixed_t neardist = INT32_MAX;
player_t *nearplayer = NULL;
//Find new botleader
for (i = 0; i < MAXPLAYERS; i++)
{
if (players[i].bot || players[i].playerstate != PST_LIVE || players[i].spectator || !players[i].mo)
continue;
if (!player->botleader)
{
player->botleader = &players[i]; // set default
return;
}
if (!player->mo)
return;
//Update best candidate based on nearest distance
dist = R_PointToDist2(player->mo->x, player->mo->y, players[i].mo->x, players[i].mo->y);
if (neardist > dist)
{
neardist = dist;
nearplayer = &players[i];
}
}
//Set botleader to best candidate (or null if none available)
player->botleader = nearplayer;
}
static inline void B_ResetAI(botmem_t *mem)
{
mem->thinkstate = AI_FOLLOW;
mem->catchup_tics = 0;
}
static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
@ -49,39 +64,47 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
player_t *player = sonic->player, *bot = tails->player;
ticcmd_t *pcmd = &player->cmd;
boolean water = tails->eflags & MFE_UNDERWATER;
botmem_t *mem = &bot->botmem;
boolean water = (tails->eflags & MFE_UNDERWATER);
SINT8 flip = P_MobjFlip(tails);
boolean _2d = (tails->flags2 & MF2_TWOD) || twodlevel;
fixed_t scale = tails->scale;
boolean jump_last = (bot->lastbuttons & BT_JUMP);
boolean spin_last = (bot->lastbuttons & BT_SPIN);
fixed_t dist = P_AproxDistance(sonic->x - tails->x, sonic->y - tails->y);
fixed_t zdist = flip * (sonic->z - tails->z);
angle_t ang = sonic->angle;
fixed_t pmom = P_AproxDistance(sonic->momx, sonic->momy);
fixed_t bmom = P_AproxDistance(tails->momx, tails->momy);
fixed_t followmax = 128 * 8 * scale; // Max follow distance before AI begins to enter "panic" state
fixed_t followmax = 128 * 8 * scale; // Max follow distance before AI begins to enter catchup state
fixed_t followthres = 92 * scale; // Distance that AI will try to reach
fixed_t followmin = 32 * scale;
fixed_t comfortheight = 96 * scale;
fixed_t touchdist = 24 * scale;
boolean stalled = (bmom < scale >> 1) && dist > followthres; // Helps to see if the AI is having trouble catching up
boolean samepos = (sonic->x == tails->x && sonic->y == tails->y);
boolean blocked = bot->blocked;
if (!samepos)
ang = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y);
// We can't follow Sonic if he's not around!
if (!sonic || sonic->health <= 0)
// Lua can handle it!
if (LUA_HookBotAI(sonic, tails, cmd))
return;
// Lua can handle it!
if (LUAh_BotAI(sonic, tails, cmd))
// We can't follow Sonic if he's not around!
if (!sonic || sonic->health <= 0)
{
mem->thinkstate = AI_STANDBY;
return;
}
else if (mem->thinkstate == AI_STANDBY)
mem->thinkstate = AI_FOLLOW;
if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC)
{
boolean isrelevant = (sonic->player->powers[pw_carry] == CR_MACESPIN || sonic->player->powers[pw_carry] == CR_GENERIC);
dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y);
if (sonic->player->cmd.buttons & BT_JUMP && (sonic->player->pflags & PF_JUMPED) && isrelevant)
cmd->buttons |= BT_JUMP;
if (isrelevant)
@ -103,56 +126,57 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
followmin = 0;
followthres = 16*scale;
followmax >>= 1;
thinkfly = false;
if (mem->thinkstate == AI_THINKFLY)
mem->thinkstate = AI_FOLLOW;
}
// Check anxiety
if (spinmode)
// Update catchup_tics
if (mem->thinkstate == AI_SPINFOLLOW)
{
anxiety = 0;
panic = false;
mem->catchup_tics = 0;
}
else if (dist > followmax || zdist > comfortheight || stalled)
{
anxiety = min(anxiety + 2, 70);
if (anxiety >= 70)
panic = true;
mem->catchup_tics = min(mem->catchup_tics + 2, 70);
if (mem->catchup_tics >= 70)
mem->thinkstate = AI_CATCHUP;
}
else
{
anxiety = max(anxiety - 1, 0);
panic = false;
mem->catchup_tics = max(mem->catchup_tics - 1, 0);
if (mem->thinkstate == AI_CATCHUP)
mem->thinkstate = AI_FOLLOW;
}
// Orientation
// cmd->angleturn won't be relative to player angle, since we're not going through G_BuildTiccmd.
if (bot->pflags & (PF_SPINNING|PF_STARTDASH))
{
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->angleturn = (sonic->angle) >> 16; // NOT FRACBITS DAMNIT
}
else if (flymode == 2)
else if (mem->thinkstate == AI_FLYCARRY)
{
cmd->angleturn = sonic->player->cmd.angleturn - (tails->angle >> 16);
cmd->angleturn = sonic->player->cmd.angleturn;
}
else
{
cmd->angleturn = (ang - tails->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->angleturn = (ang) >> 16; // NOT FRACBITS DAMNIT
}
// ********
// FLY MODE
// spinmode check
if (spinmode || player->exiting)
thinkfly = false;
// exiting check
if (player->exiting && mem->thinkstate == AI_THINKFLY)
mem->thinkstate = AI_FOLLOW;
else
{
// Activate co-op flight
if (thinkfly && player->pflags & PF_JUMPED)
if (mem->thinkstate == AI_THINKFLY && player->pflags & PF_JUMPED)
{
if (!jump_last)
{
jump = true;
flymode = 1;
thinkfly = false;
mem->thinkstate = AI_FLYSTANDBY;
bot->pflags |= PF_CANCARRY;
}
}
@ -165,20 +189,19 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
&& P_IsObjectOnGround(sonic) && P_IsObjectOnGround(tails)
&& !(player->pflags & PF_STASIS)
&& bot->charability == CA_FLY)
thinkfly = true;
else
thinkfly = false;
mem->thinkstate = AI_THINKFLY;
else if (mem->thinkstate == AI_THINKFLY)
mem->thinkstate = AI_FOLLOW;
// Set carried state
if (player->powers[pw_carry] == CR_PLAYER && sonic->tracer == tails)
{
flymode = 2;
mem->thinkstate = AI_FLYCARRY;
}
// Ready for takeoff
if (flymode == 1)
if (mem->thinkstate == AI_FLYSTANDBY)
{
thinkfly = false;
if (zdist < -64*scale || (flip * tails->momz) > scale) // Make sure we're not too high up
spin = true;
else if (!jump_last)
@ -186,10 +209,10 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// Abort if the player moves away or spins
if (dist > followthres || player->dashspeed)
flymode = 0;
mem->thinkstate = AI_FOLLOW;
}
// Read player inputs while carrying
else if (flymode == 2)
else if (mem->thinkstate == AI_FLYCARRY)
{
cmd->forwardmove = pcmd->forwardmove;
cmd->sidemove = pcmd->sidemove;
@ -203,19 +226,19 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// End flymode
if (player->powers[pw_carry] != CR_PLAYER)
{
flymode = 0;
mem->thinkstate = AI_FOLLOW;
}
}
}
if (flymode && P_IsObjectOnGround(tails) && !(pcmd->buttons & BT_JUMP))
flymode = 0;
if (P_IsObjectOnGround(tails) && !(pcmd->buttons & BT_JUMP) && (mem->thinkstate == AI_FLYSTANDBY || mem->thinkstate == AI_FLYCARRY))
mem->thinkstate = AI_FOLLOW;
// ********
// SPINNING
if (panic || flymode || !(player->pflags & PF_SPINNING) || (player->pflags & PF_JUMPED))
spinmode = false;
else
if (!(player->pflags & (PF_SPINNING|PF_STARTDASH)) && mem->thinkstate == AI_SPINFOLLOW)
mem->thinkstate = AI_FOLLOW;
else if (mem->thinkstate == AI_FOLLOW || mem->thinkstate == AI_SPINFOLLOW)
{
if (!_2d)
{
@ -224,21 +247,21 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
{
if (dist < followthres && dist > touchdist) // Do positioning
{
cmd->angleturn = (ang - tails->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->angleturn = (ang) >> 16; // NOT FRACBITS DAMNIT
cmd->forwardmove = 50;
spinmode = true;
mem->thinkstate = AI_SPINFOLLOW;
}
else if (dist < touchdist)
{
if (!bmom && (!(bot->pflags & PF_SPINNING) || (bot->dashspeed && bot->pflags & PF_SPINNING)))
{
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->angleturn = (sonic->angle) >> 16; // NOT FRACBITS DAMNIT
spin = true;
}
spinmode = true;
mem->thinkstate = AI_SPINFOLLOW;
}
else
spinmode = false;
mem->thinkstate = AI_FOLLOW;
}
// Spin
else if (player->dashspeed == bot->dashspeed && player->pflags & PF_SPINNING)
@ -246,12 +269,12 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
if (bot->pflags & PF_SPINNING || !spin_last)
{
spin = true;
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->angleturn = (sonic->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->forwardmove = MAXPLMOVE;
spinmode = true;
mem->thinkstate = AI_SPINFOLLOW;
}
else
spinmode = false;
mem->thinkstate = AI_FOLLOW;
}
}
// 2D mode
@ -261,17 +284,19 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
&& ((bot->pflags & PF_SPINNING) || !spin_last))
{
spin = true;
spinmode = true;
mem->thinkstate = AI_SPINFOLLOW;
}
else
mem->thinkstate = AI_FOLLOW;
}
}
// ********
// FOLLOW
if (!(flymode || spinmode))
if (mem->thinkstate == AI_FOLLOW || mem->thinkstate == AI_CATCHUP)
{
// Too far
if (panic || dist > followthres)
if (mem->thinkstate == AI_CATCHUP || dist > followthres)
{
if (!_2d)
cmd->forwardmove = MAXPLMOVE;
@ -281,7 +306,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
cmd->sidemove = -MAXPLMOVE;
}
// Within threshold
else if (!panic && dist > followmin && abs(zdist) < 192*scale)
else if (dist > followmin && abs(zdist) < 192*scale)
{
if (!_2d)
cmd->forwardmove = FixedHypot(pcmd->forwardmove, pcmd->sidemove);
@ -292,8 +317,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
else if (dist < followmin)
{
// Copy inputs
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
bot->drawangle = ang;
cmd->angleturn = (sonic->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->forwardmove = 8 * pcmd->forwardmove / 10;
cmd->sidemove = 8 * pcmd->sidemove / 10;
}
@ -301,7 +325,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// ********
// JUMP
if (!(flymode || spinmode))
if (mem->thinkstate == AI_FOLLOW || mem->thinkstate == AI_CATCHUP || (mem->thinkstate == AI_SPINFOLLOW && player->pflags & PF_JUMPED))
{
// Flying catch-up
if (bot->pflags & PF_THOKKED)
@ -319,35 +343,36 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// Start jump
else if (!jump_last && !(bot->pflags & PF_JUMPED) //&& !(player->pflags & PF_SPINNING)
&& ((zdist > 32*scale && player->pflags & PF_JUMPED) // Following
|| (zdist > 64*scale && panic) // Vertical catch-up
|| (stalled && anxiety > 20 && bot->powers[pw_carry] == CR_NONE)
|| (zdist > 64*scale && mem->thinkstate == AI_CATCHUP) // Vertical catch-up
|| (stalled && mem->catchup_tics > 20 && bot->powers[pw_carry] == CR_NONE)
//|| (bmom < scale>>3 && dist > followthres && !(bot->powers[pw_carry])) // Stopped & not in carry state
|| (bot->pflags & PF_SPINNING && !(bot->pflags & PF_JUMPED)))) // Spinning
jump = true;
// Hold jump
else if (bot->pflags & PF_JUMPED && jump_last && tails->momz*flip > 0 && (zdist > 0 || panic))
else if (bot->pflags & PF_JUMPED && jump_last && tails->momz*flip > 0 && (zdist > 0 || mem->thinkstate == AI_CATCHUP))
jump = true;
// Start flying
else if (bot->pflags & PF_JUMPED && panic && !jump_last && bot->charability == CA_FLY)
else if (bot->pflags & PF_JUMPED && mem->thinkstate == AI_CATCHUP && !jump_last && bot->charability == CA_FLY)
jump = true;
}
// ********
// HISTORY
jump_last = jump;
spin_last = spin;
//jump_last = jump;
//spin_last = spin;
// Turn the virtual keypresses into ticcmd_t.
B_KeysToTiccmd(tails, cmd, forward, backward, left, right, false, false, jump, spin);
// Update our status
lastForward = forward;
lastBlocked = blocked;
blocked = false;
mem->lastForward = forward;
mem->lastBlocked = blocked;
}
void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
{
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
// Can't build a ticcmd if we aren't spawned...
if (!player->mo)
return;
@ -363,25 +388,28 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
CV_SetValue(&cv_analog[1], false);
// Let Lua scripts build ticcmds
if (LUAh_BotTiccmd(player, cmd))
if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)))
return;
// We don't have any main character AI, sorry. D:
if (player-players == consoleplayer)
// Make sure we have a valid main character to follow
B_UpdateBotleader(player);
if (!player->botleader)
return;
// Basic Tails AI
B_BuildTailsTiccmd(players[consoleplayer].mo, player->mo, cmd);
// Single Player Tails AI
//B_BuildTailsTiccmd(players[consoleplayer].mo, player->mo, cmd);
B_BuildTailsTiccmd(player->botleader->mo, player->mo, cmd);
}
void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin)
{
player_t *player = mo->player;
// don't try to do stuff if your sonic is in a minecart or something
if (players[consoleplayer].powers[pw_carry] && players[consoleplayer].powers[pw_carry] != CR_PLAYER)
if (player->botleader && player->botleader->powers[pw_carry] && player->botleader->powers[pw_carry] != CR_PLAYER)
return;
// Turn the virtual keypresses into ticcmd_t.
if (twodlevel || mo->flags2 & MF2_TWOD) {
if (players[consoleplayer].climbing
if (player->botleader->climbing
|| mo->player->pflags & PF_GLIDING) {
// Don't mess with bot inputs during these unhandled movement conditions.
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
@ -420,10 +448,10 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
if (left)
if (left)
cmd->angleturn += 1280;
if (right)
cmd->angleturn -= 1280;
cmd->angleturn -= 1280;
if (strafeleft)
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
if (straferight)
@ -447,21 +475,26 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
void B_MoveBlocked(player_t *player)
{
(void)player;
blocked = true;
player->blocked = true;
}
boolean B_CheckRespawn(player_t *player)
{
mobj_t *sonic = players[consoleplayer].mo;
mobj_t *sonic;
mobj_t *tails = player->mo;
//We don't have a main player to spawn to!
if (!player->botleader)
return false;
sonic = player->botleader->mo;
// We can't follow Sonic if he's not around!
if (!sonic || sonic->health <= 0)
return false;
// B_RespawnBot doesn't do anything if the condition above this isn't met
{
UINT8 shouldForce = LUAh_BotRespawn(sonic, tails);
UINT8 shouldForce = LUA_Hook2Mobj(sonic, tails, MOBJ_HOOK(BotRespawn));
if (P_MobjWasRemoved(sonic) || P_MobjWasRemoved(tails))
return (shouldForce == 1); // mobj was removed
@ -505,15 +538,19 @@ void B_RespawnBot(INT32 playernum)
{
player_t *player = &players[playernum];
fixed_t x,y,z;
mobj_t *sonic = players[consoleplayer].mo;
mobj_t *sonic;
mobj_t *tails;
if (!player->botleader)
return;
sonic = player->botleader->mo;
if (!sonic || sonic->health <= 0)
return;
B_ResetAI();
B_ResetAI(&player->botmem);
player->bot = 1;
player->bot = BOT_2PAI;
P_SpawnPlayer(playernum);
tails = player->mo;
@ -540,10 +577,6 @@ void B_RespawnBot(INT32 playernum)
player->powers[pw_spacetime] = sonic->player->powers[pw_spacetime];
player->powers[pw_gravityboots] = sonic->player->powers[pw_gravityboots];
player->powers[pw_nocontrol] = sonic->player->powers[pw_nocontrol];
player->acceleration = sonic->player->acceleration;
player->accelstart = sonic->player->accelstart;
player->thrustfactor = sonic->player->thrustfactor;
player->normalspeed = sonic->player->normalspeed;
player->pflags |= PF_AUTOBRAKE|(sonic->player->pflags & PF_DIRECTIONCHAR);
P_TeleportMove(tails, x, y, z);
@ -561,26 +594,44 @@ void B_RespawnBot(INT32 playernum)
void B_HandleFlightIndicator(player_t *player)
{
mobj_t *tails = player->mo;
botmem_t *mem = &player->botmem;
boolean shouldExist;
if (!tails)
return;
if (thinkfly && player->bot == 1 && tails->health)
shouldExist = (mem->thinkstate == AI_THINKFLY) && player->botleader
&& player->bot == BOT_2PAI && player->playerstate == PST_LIVE;
// check whether the indicator doesn't exist
if (P_MobjWasRemoved(tails->hnext))
{
if (!tails->hnext)
{
P_SetTarget(&tails->hnext, P_SpawnMobjFromMobj(tails, 0, 0, 0, MT_OVERLAY));
if (tails->hnext)
{
P_SetTarget(&tails->hnext->target, tails);
P_SetTarget(&tails->hnext->hprev, tails);
P_SetMobjState(tails->hnext, S_FLIGHTINDICATOR);
}
}
// if it shouldn't exist, everything is fine
if (!shouldExist)
return;
// otherwise, spawn it
P_SetTarget(&tails->hnext, P_SpawnMobjFromMobj(tails, 0, 0, 0, MT_OVERLAY));
P_SetTarget(&tails->hnext->target, tails);
P_SetTarget(&tails->hnext->hprev, tails);
P_SetMobjState(tails->hnext, S_FLIGHTINDICATOR);
}
else if (tails->hnext && tails->hnext->type == MT_OVERLAY && tails->hnext->state == states+S_FLIGHTINDICATOR)
// if the mobj isn't a flight indicator, let's not mess with it
if (tails->hnext->type != MT_OVERLAY || (tails->hnext->state != states+S_FLIGHTINDICATOR))
return;
// if it shouldn't exist, remove it
if (!shouldExist)
{
P_RemoveMobj(tails->hnext);
P_SetTarget(&tails->hnext, NULL);
return;
}
// otherwise, update its visibility
if (P_IsLocalPlayer(player->botleader))
tails->hnext->flags2 &= ~MF2_DONTDRAW;
else
tails->hnext->flags2 |= MF2_DONTDRAW;
}

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2021 by Sonic Team Junior.
// Copyright (C) 2012-2022 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -10,6 +10,7 @@
/// \file b_bot.h
/// \brief Basic bot handling
void B_UpdateBotleader(player_t *player);
void B_BuildTiccmd(player_t *player, ticcmd_t *cmd);
void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin);
boolean B_CheckRespawn(player_t *player);

1
src/blua/CMakeLists.txt Normal file
View file

@ -0,0 +1 @@
target_sourcefile(c)

View file

@ -1,53 +0,0 @@
ifdef UNIXCOMMON
LUA_CFLAGS+=-DLUA_USE_POSIX
endif
ifdef LINUX
LUA_CFLAGS+=-DLUA_USE_POSIX
endif
ifdef GCC43
ifndef GCC44
WFLAGS+=-Wno-logical-op
endif
endif
OBJS:=$(OBJS) \
$(OBJDIR)/lapi.o \
$(OBJDIR)/lbaselib.o \
$(OBJDIR)/ldo.o \
$(OBJDIR)/lfunc.o \
$(OBJDIR)/linit.o \
$(OBJDIR)/liolib.o \
$(OBJDIR)/llex.o \
$(OBJDIR)/lmem.o \
$(OBJDIR)/lobject.o \
$(OBJDIR)/lstate.o \
$(OBJDIR)/lstrlib.o \
$(OBJDIR)/ltablib.o \
$(OBJDIR)/lundump.o \
$(OBJDIR)/lzio.o \
$(OBJDIR)/lauxlib.o \
$(OBJDIR)/lcode.o \
$(OBJDIR)/ldebug.o \
$(OBJDIR)/ldump.o \
$(OBJDIR)/lgc.o \
$(OBJDIR)/lopcodes.o \
$(OBJDIR)/lparser.o \
$(OBJDIR)/lstring.o \
$(OBJDIR)/ltable.o \
$(OBJDIR)/ltm.o \
$(OBJDIR)/lvm.o \
$(OBJDIR)/lua_script.o \
$(OBJDIR)/lua_baselib.o \
$(OBJDIR)/lua_mathlib.o \
$(OBJDIR)/lua_hooklib.o \
$(OBJDIR)/lua_consolelib.o \
$(OBJDIR)/lua_infolib.o \
$(OBJDIR)/lua_mobjlib.o \
$(OBJDIR)/lua_playerlib.o \
$(OBJDIR)/lua_skinlib.o \
$(OBJDIR)/lua_thinkerlib.o \
$(OBJDIR)/lua_maplib.o \
$(OBJDIR)/lua_taglib.o \
$(OBJDIR)/lua_polyobjlib.o \
$(OBJDIR)/lua_blockmaplib.o \
$(OBJDIR)/lua_hudlib.o

25
src/blua/Sourcefile Normal file
View file

@ -0,0 +1,25 @@
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

View file

@ -274,7 +274,7 @@ static int luaB_dofile (lua_State *L) {
UINT16 lumpnum;
int n = lua_gettop(L);
if (wadfiles[numwadfiles - 1]->type != RET_PK3)
if (!W_FileHasFolders(wadfiles[numwadfiles - 1]))
luaL_error(L, "dofile() only works with PK3 files");
snprintf(fullfilename, sizeof(fullfilename), "Lua/%s", filename);

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
// Copyright (C) 1999-2022 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -150,26 +150,78 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
#undef DEALIGNED
#define WRITESTRINGN(p,s,n) do { size_t tmp_i = 0; for (; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); if (tmp_i < n) WRITECHAR(p, '\0');} while (0)
#define WRITESTRING(p,s) do { size_t tmp_i = 0; for (; s[tmp_i] != '\0'; tmp_i++) WRITECHAR(p, s[tmp_i]); WRITECHAR(p, '\0');} while (0)
#define WRITEMEM(p,s,n) do { memcpy(p, s, n); p += n; } while (0)
#define WRITESTRINGN(p, s, n) ({ \
size_t tmp_i; \
\
for (tmp_i = 0; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) \
WRITECHAR(p, s[tmp_i]); \
\
if (tmp_i < n) \
WRITECHAR(p, '\0'); \
})
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
#define WRITESTRINGL(p, s, n) ({ \
size_t tmp_i; \
\
for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \
WRITECHAR(p, s[tmp_i]); \
\
WRITECHAR(p, '\0'); \
})
#define READSTRINGN(p,s,n) ({ size_t tmp_i = 0; for (; tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0'; tmp_i++); s[tmp_i] = '\0';})
#define READSTRING(p,s) ({ size_t tmp_i = 0; for (; (s[tmp_i] = READCHAR(p)) != '\0'; tmp_i++); s[tmp_i] = '\0';})
#define READMEM(p,s,n) ({ memcpy(s, p, n); p += n; })
#define WRITESTRING(p, s) ({ \
size_t tmp_i; \
\
for (tmp_i = 0; s[tmp_i] != '\0'; tmp_i++) \
WRITECHAR(p, s[tmp_i]); \
\
WRITECHAR(p, '\0'); \
})
#if 0 // old names
#define WRITEBYTE(p,b) WRITEUINT8(p,b)
#define WRITESHORT(p,b) WRITEINT16(p,b)
#define WRITEUSHORT(p,b) WRITEUINT16(p,b)
#define WRITELONG(p,b) WRITEINT32(p,b)
#define WRITEULONG(p,b) WRITEUINT32(p,b)
#define WRITEMEM(p, s, n) ({ \
memcpy(p, s, n); \
p += n; \
})
#define READBYTE(p) READUINT8(p)
#define READSHORT(p) READINT16(p)
#define READUSHORT(p) READUINT16(p)
#define READLONG(p) READINT32(p)
#define READULONG(p) READUINT32(p)
#endif
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
#define SKIPSTRINGN(p, n) ({ \
size_t tmp_i = 0; \
\
while (tmp_i < n && READCHAR(p) != '\0') \
tmp_i++; \
})
#define SKIPSTRINGL(p, n) SKIPSTRINGN(p, n)
#define READSTRINGN(p, s, n) ({ \
size_t tmp_i = 0; \
\
while (tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
})
#define READSTRINGL(p, s, n) ({ \
size_t tmp_i = 0; \
\
while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
})
#define READSTRING(p, s) ({ \
size_t tmp_i = 0; \
\
while ((s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
})
#define READMEM(p, s, n) ({ \
memcpy(s, p, n); \
p += n; \
})

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2021 by Sonic Team Junior.
// Copyright (C) 1999-2022 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -650,7 +650,7 @@ static void COM_ExecuteString(char *ptext)
else
{ // Monster Iestyn: keep track of how many levels of recursion we're in
recursion++;
COM_BufInsertText(a->value);
COM_BufInsertTextEx(a->value, com_flags);
recursion--;
}
return;
@ -1738,6 +1738,8 @@ void CV_SaveVars(UINT8 **p, boolean in_demo)
static void CV_LoadVars(UINT8 **p,
consvar_t *(*got)(UINT8 **p, char **ret_value, boolean *ret_stealth))
{
const boolean store = (client || demoplayback);
consvar_t *cvar;
UINT16 count;
@ -1751,7 +1753,7 @@ static void CV_LoadVars(UINT8 **p,
{
if (cvar->flags & CV_NETVAR)
{
if (client && cvar->revert.v.string == NULL)
if (store && cvar->revert.v.string == NULL)
{
cvar->revert.v.const_munge = cvar->string;
cvar->revert.allocated = ( cvar->zstring != NULL );
@ -2364,7 +2366,10 @@ static boolean CV_Command(void)
return false;
if (( com_flags & COM_SAFE ) && ( v->flags & CV_NOLUA ))
return false;
{
CONS_Alert(CONS_WARNING, "Variable '%s' cannot be changed from Lua.\n", v->name);
return true;
}
// perform a variable print or set
if (COM_Argc() == 1)

Some files were not shown because too many files have changed in this diff Show more