Merge remote-tracking branch 'stjr/next' into thokking-hell

This commit is contained in:
Radicalicious 2021-12-03 21:46:58 -06:00
commit cbb8269dec
314 changed files with 16509 additions and 10382 deletions

4
.gitignore vendored
View file

@ -13,11 +13,11 @@ Win32_LIB_ASM_Release
*.dgb *.dgb
*.debug *.debug
*.debug.txt *.debug.txt
/bin/VC10/
/objs/VC10/
*.user *.user
*.db *.db
*.opendb *.opendb
/.vs /.vs
/debian /debian
/assets/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 # Enable CCache early
set(SRB2_USE_CCACHE OFF CACHE BOOL "Use CCache") 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 ### Useful functions
# Prepend sources with current source directory # Add sources from Sourcefile
function(prepend_sources SOURCE_FILES) function(target_sourcefile type)
foreach(SOURCE_FILE ${${SOURCE_FILES}}) file(STRINGS Sourcefile list
set(MODIFIED ${MODIFIED} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) REGEX "[-0-9A-Za-z_]+\.${type}")
endforeach() target_sources(SRB2SDL2 PRIVATE ${list})
set(${SOURCE_FILES} ${MODIFIED} PARENT_SCOPE)
endfunction() endfunction()
# Macro to add OSX framework # 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 # 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://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) [![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.8.{branch}-{build} version: 2.2.9.{branch}-{build}
os: MinGW os: MinGW
environment: environment:
CC: ccache CC: i686-w64-mingw32-gcc
CCACHE_CC: i686-w64-mingw32-gcc
CCACHE_CC_64: x86_64-w64-mingw32-gcc
WINDRES: windres WINDRES: windres
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead # c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
MINGW_SDK: c:\msys64\mingw32 MINGW_SDK: c:\msys64\mingw32
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead CFLAGS: -Wno-implicit-fallthrough
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
NASM_ZIP: nasm-2.12.01 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 NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip
UPX_ZIP: upx391w UPX_ZIP: upx391w
@ -19,8 +15,6 @@ environment:
CCACHE_URL: http://alam.srb2.org/ccache.exe CCACHE_URL: http://alam.srb2.org/ccache.exe
CCACHE_COMPRESS: true CCACHE_COMPRESS: true
CCACHE_DIR: C:\Users\appveyor\.ccache CCACHE_DIR: C:\Users\appveyor\.ccache
# Disable UPX by default. The user can override this in their Appveyor project settings
NOUPX: 1
############################## ##############################
# DEPLOYER VARIABLES # DEPLOYER VARIABLES
# DPL_ENABLED=1 builds installers for branch names starting with `deployer`. # DPL_ENABLED=1 builds installers for branch names starting with `deployer`.
@ -53,11 +47,6 @@ cache:
- C:\Users\appveyor\srb2_cache - C:\Users\appveyor\srb2_cache
install: 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" - if not exist "%NASM_ZIP%.zip" appveyor DownloadFile "%NASM_URL%" -FileName "%NASM_ZIP%.zip"
- 7z x -y "%NASM_ZIP%.zip" -o%TMP% >null - 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 - 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: configuration:
- SDL - SDL
- SDL64
before_build: before_build:
- set "Path=%MINGW_SDK%\bin;%Path%" - 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 - mingw32-make --version
- if not [%X86_64%] == [1] ( nasm -v ) - nasm -v
- if not [%NOUPX%] == [1] ( upx -V ) - if not [%NOUPX%] == [1] ( upx -V )
- ccache -V - ccache -V
- ccache -s - 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%" ) - 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: git rev-parse --short %COMMIT%>%TMP%/gitshort.txt
- cmd: set /P GITSHORT=<%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 # for pull requests, take the owner's name only, if this isn't the same repo of course
- set "REPO=%APPVEYOR_REPO_BRANCH%" - 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%" ) ) - 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 NOECHOFILENAMES=1 CCACHE=1 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"
build_script: build_script:
- cmd: mingw32-make.exe %SRB2_MFLAGS% clean - cmd: mingw32-make.exe %SRB2_MFLAGS% clean
- cmd: mingw32-make.exe %SRB2_MFLAGS% ERRORMODE=1 -k - cmd: mingw32-make.exe %SRB2_MFLAGS% ERRORMODE=1 -k
after_build: 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 - ccache -s
- set BUILD_ARCHIVE=%REPO%-%GITSHORT%-%CONFIGURATION%.7z - set BUILD_ARCHIVE=%REPO%-%GITSHORT%-%CONFIGURATION%.7z
- set BUILDSARCHIVE=%REPO%-%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% - appveyor PushArtifact %BUILD_ARCHIVE%
#- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE% #- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
#- appveyor PushArtifact %BUILDSARCHIVE% #- appveyor PushArtifact %BUILDSARCHIVE%
@ -139,3 +116,4 @@ test: off
on_finish: on_finish:
#- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:<ip>:<port> #- 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')) #- 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

@ -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 MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) NOOBJDUMP=1 # SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)" MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)" MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
BINDIR := $(DIR)/bin/Linux/Release BINDIR := $(DIR)/bin/
# FIXME pkg-config dir hacks # FIXME pkg-config dir hacks
# Launchpad doesn't need this; it actually makes i386 builds fail due to cross-compile # Launchpad doesn't need this; it actually makes i386 builds fail due to cross-compile

View file

@ -640,6 +640,39 @@ linedeftypes
prefix = "(63)"; 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 540
{ {
title = "Floor Friction"; title = "Floor Friction";
@ -746,13 +779,13 @@ linedeftypes
20 20
{ {
title = "First Line"; title = "PolyObject First Line";
prefix = "(20)"; prefix = "(20)";
} }
22 22
{ {
title = "Parameters"; title = "PolyObject Parameters";
prefix = "(22)"; prefix = "(22)";
flags8text = "[3] Set translucency by X offset"; flags8text = "[3] Set translucency by X offset";
flags32text = "[5] Render outer sides only"; flags32text = "[5] Render outer sides only";
@ -765,19 +798,19 @@ linedeftypes
30 30
{ {
title = "Waving Flag"; title = "PolyObject Waving Flag";
prefix = "(30)"; prefix = "(30)";
} }
31 31
{ {
title = "Displacement by Front Sector"; title = "Move PolyObject by Front Sector Displacement";
prefix = "(31)"; prefix = "(31)";
} }
32 32
{ {
title = "Angular Displacement by Front Sector"; title = "Rotate PolyObject by Front Sector Displacement";
prefix = "(32)"; prefix = "(32)";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
flags512text = "[9] Turn all objects"; flags512text = "[9] Turn all objects";
@ -1959,7 +1992,7 @@ linedeftypes
title = "Set Tagged Sector's Floor Height/Texture"; title = "Set Tagged Sector's Floor Height/Texture";
prefix = "(400)"; prefix = "(400)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Keep floor flat"; flags64text = "[6] Don't change floor texture";
} }
401 401
@ -1967,6 +2000,7 @@ linedeftypes
title = "Set Tagged Sector's Ceiling Height/Texture"; title = "Set Tagged Sector's Ceiling Height/Texture";
prefix = "(401)"; prefix = "(401)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't change ceiling texture";
} }
402 402
@ -2057,7 +2091,7 @@ linedeftypes
prefix = "(403)"; prefix = "(403)";
flags2text = "[1] Trigger linedef executor"; flags2text = "[1] Trigger linedef executor";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Change floor flat"; flags64text = "[6] Change floor texture";
} }
404 404
@ -2066,7 +2100,7 @@ linedeftypes
prefix = "(404)"; prefix = "(404)";
flags2text = "[1] Trigger linedef executor"; flags2text = "[1] Trigger linedef executor";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Change ceiling flat"; flags64text = "[6] Change ceiling texture";
} }
405 405
@ -2498,35 +2532,35 @@ linedeftypes
480 480
{ {
title = "Door Slide"; title = "PolyObject Door Slide";
prefix = "(480)"; prefix = "(480)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
481 481
{ {
title = "Door Swing"; title = "PolyObject Door Swing";
prefix = "(481)"; prefix = "(481)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
482 482
{ {
title = "Move"; title = "Move PolyObject";
prefix = "(482)"; prefix = "(482)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
483 483
{ {
title = "Move, Override"; title = "Move PolyObject, Override";
prefix = "(483)"; prefix = "(483)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
484 484
{ {
title = "Rotate Right"; title = "Rotate PolyObject Right";
prefix = "(484)"; prefix = "(484)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
@ -2535,7 +2569,7 @@ linedeftypes
485 485
{ {
title = "Rotate Right, Override"; title = "Rotate PolyObject Right, Override";
prefix = "(485)"; prefix = "(485)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
@ -2544,7 +2578,7 @@ linedeftypes
486 486
{ {
title = "Rotate Left"; title = "Rotate PolyObject Left";
prefix = "(486)"; prefix = "(486)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
@ -2553,7 +2587,7 @@ linedeftypes
487 487
{ {
title = "Rotate Left, Override"; title = "Rotate PolyObject Left, Override";
prefix = "(487)"; prefix = "(487)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
@ -2562,7 +2596,7 @@ linedeftypes
488 488
{ {
title = "Move by Waypoints"; title = "Move PolyObject by Waypoints";
prefix = "(488)"; prefix = "(488)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags32text = "[5] Reverse order"; flags32text = "[5] Reverse order";
@ -2573,7 +2607,7 @@ linedeftypes
489 489
{ {
title = "Turn Invisible, Intangible"; title = "Turn PolyObject Invisible, Intangible";
prefix = "(489)"; prefix = "(489)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Only invisible"; flags64text = "[6] Only invisible";
@ -2581,7 +2615,7 @@ linedeftypes
490 490
{ {
title = "Turn Visible, Tangible"; title = "Turn PolyObject Visible, Tangible";
prefix = "(490)"; prefix = "(490)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Only visible"; flags64text = "[6] Only visible";
@ -2589,7 +2623,7 @@ linedeftypes
491 491
{ {
title = "Set Translucency"; title = "Set PolyObject Translucency";
prefix = "(491)"; prefix = "(491)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags16text = "[4] Set raw alpha by Front X"; flags16text = "[4] Set raw alpha by Front X";
@ -2598,7 +2632,7 @@ linedeftypes
492 492
{ {
title = "Fade Translucency"; title = "Fade PolyObject Translucency";
prefix = "(492)"; prefix = "(492)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags16text = "[4] Set raw alpha by Front X"; flags16text = "[4] Set raw alpha by Front X";
@ -2917,8 +2951,10 @@ linedeftypes
prefix = "(700)"; prefix = "(700)";
flags2048text = "[11] No physics"; flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic"; flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular"; slope = "regular";
slopeargs = 1; slopeargs = 1;
copyslopeargs = 1;
} }
701 701
@ -2927,8 +2963,10 @@ linedeftypes
prefix = "(701)"; prefix = "(701)";
flags2048text = "[11] No physics"; flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic"; flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular"; slope = "regular";
slopeargs = 2; slopeargs = 2;
copyslopeargs = 4;
} }
702 702
@ -2937,8 +2975,10 @@ linedeftypes
prefix = "(702)"; prefix = "(702)";
flags2048text = "[11] No physics"; flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic"; flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular"; slope = "regular";
slopeargs = 3; slopeargs = 3;
copyslopeargs = 5;
} }
703 703
@ -2947,8 +2987,10 @@ linedeftypes
prefix = "(703)"; prefix = "(703)";
flags2048text = "[11] No physics"; flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic"; flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular"; slope = "regular";
slopeargs = 9; slopeargs = 9;
copyslopeargs = 8;
} }
704 704
@ -2979,8 +3021,10 @@ linedeftypes
prefix = "(710)"; prefix = "(710)";
flags2048text = "[11] No physics"; flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic"; flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular"; slope = "regular";
slopeargs = 4; slopeargs = 4;
copyslopeargs = 2;
} }
711 711
@ -2989,8 +3033,10 @@ linedeftypes
prefix = "(711)"; prefix = "(711)";
flags2048text = "[11] No physics"; flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic"; flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular"; slope = "regular";
slopeargs = 8; slopeargs = 8;
copyslopeargs = 8;
} }
712 712
@ -2999,8 +3045,10 @@ linedeftypes
prefix = "(712)"; prefix = "(712)";
flags2048text = "[11] No physics"; flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic"; flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular"; slope = "regular";
slopeargs = 12; slopeargs = 12;
copyslopeargs = 10;
} }
713 713
@ -3009,8 +3057,10 @@ linedeftypes
prefix = "(713)"; prefix = "(713)";
flags2048text = "[11] No physics"; flags2048text = "[11] No physics";
flags4096text = "[12] Dynamic"; flags4096text = "[12] Dynamic";
flags32768text = "[15] Copy to other side";
slope = "regular"; slope = "regular";
slopeargs = 6; slopeargs = 6;
copyslopeargs = 6;
} }
714 714
@ -3059,6 +3109,78 @@ linedeftypes
slopeargs = 3; slopeargs = 3;
} }
723
{
title = "Copy Backside Floor Slope from Line Tag";
prefix = "(720)";
slope = "copy";
slopeargs = 4;
}
724
{
title = "Copy Backside Ceiling Slope from Line Tag";
prefix = "(721)";
slope = "copy";
slopeargs = 8;
}
725
{
title = "Copy Backside Floor and Ceiling Slope from Line Tag";
prefix = "(722)";
slope = "copy";
slopeargs = 12;
}
730
{
title = "Copy Frontside Floor Slope to Backside";
prefix = "(730)";
slope = "copy";
copyslopeargs = 1;
}
731
{
title = "Copy Frontside Ceiling Slope to Backside";
prefix = "(731)";
slope = "copy";
copyslopeargs = 4;
}
732
{
title = "Copy Frontside Floor and Ceiling Slope to Backside";
prefix = "(732)";
slope = "copy";
copyslopeargs = 5;
}
733
{
title = "Copy Backside Floor Slope to Frontside";
prefix = "(733)";
slope = "copy";
copyslopeargs = 2;
}
734
{
title = "Copy Backside Ceiling Slope to Frontside";
prefix = "(734)";
slope = "copy";
copyslopeargs = 8;
}
735
{
title = "Copy Backside Floor and Ceiling Slope to Frontside";
prefix = "(735)";
slope = "copy";
copyslopeargs = 10;
}
799 799
{ {
title = "Set Tagged Dynamic Slope Vertex to Front Sector Height"; title = "Set Tagged Dynamic Slope Vertex to Front Sector Height";
@ -3393,6 +3515,7 @@ thingtypes
width = 8; width = 8;
height = 28; height = 28;
angletext = "Jump strength"; angletext = "Jump strength";
fixedrotation = 1;
} }
103 103
{ {
@ -3431,6 +3554,7 @@ thingtypes
width = 12; width = 12;
height = 64; height = 64;
angletext = "Firing delay"; angletext = "Firing delay";
fixedrotation = 1;
} }
122 122
{ {
@ -3482,6 +3606,7 @@ thingtypes
sprite = "ARCHA1"; sprite = "ARCHA1";
width = 24; width = 24;
height = 32; height = 32;
flags8text = "[8] Don't jump away";
} }
118 118
{ {
@ -3547,9 +3672,10 @@ thingtypes
{ {
title = "Pterabyte Spawner"; title = "Pterabyte Spawner";
sprite = "PTERA2A8"; sprite = "PTERA2A8";
width = 16; width = 24;
height = 16; height = 48;
parametertext = "No. Pterabytes"; parametertext = "Spawns +1";
arrow = 0;
} }
136 136
{ {
@ -3771,6 +3897,7 @@ thingtypes
height = 16; height = 16;
sprite = "internal:capsule"; sprite = "internal:capsule";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
292 292
{ {
@ -3781,11 +3908,13 @@ thingtypes
flags8text = "[8] Sea Egg shooting point"; flags8text = "[8] Sea Egg shooting point";
sprite = "internal:eggmanway"; sprite = "internal:eggmanway";
angletext = "No. (Sea Egg)"; angletext = "No. (Sea Egg)";
fixedrotation = 1;
flagsvaluetext = "No. (Brak)"; flagsvaluetext = "No. (Brak)";
parametertext = "Next"; parametertext = "Next";
} }
293 293
{ {
arrow = 0;
title = "Metal Sonic Gather Point"; title = "Metal Sonic Gather Point";
sprite = "internal:metal"; sprite = "internal:metal";
width = 8; width = 8;
@ -3793,6 +3922,7 @@ thingtypes
} }
294 294
{ {
arrow = 0;
title = "Fang Waypoint"; title = "Fang Waypoint";
flags8text = "[8] Center waypoint"; flags8text = "[8] Center waypoint";
sprite = "internal:eggmanway"; sprite = "internal:eggmanway";
@ -3820,79 +3950,79 @@ thingtypes
301 301
{ {
title = "Bounce Ring"; title = "Bounce Ring";
sprite = "internal:RNGBA0"; sprite = "RNGBA0";
} }
302 302
{ {
title = "Rail Ring"; title = "Rail Ring";
sprite = "internal:RNGRA0"; sprite = "RNGRA0";
} }
303 303
{ {
title = "Infinity Ring"; title = "Infinity Ring";
sprite = "internal:RNGIA0"; sprite = "RNGIA0";
} }
304 304
{ {
title = "Automatic Ring"; title = "Automatic Ring";
sprite = "internal:RNGAA0"; sprite = "RNGAA0";
} }
305 305
{ {
title = "Explosion Ring"; title = "Explosion Ring";
sprite = "internal:RNGEA0"; sprite = "RNGEA0";
} }
306 306
{ {
title = "Scatter Ring"; title = "Scatter Ring";
sprite = "internal:RNGSA0"; sprite = "RNGSA0";
} }
307 307
{ {
title = "Grenade Ring"; title = "Grenade Ring";
sprite = "internal:RNGGA0"; sprite = "RNGGA0";
} }
308 308
{ {
title = "CTF Team Ring (Red)"; title = "CTF Team Ring (Red)";
sprite = "internal:RRNGA0"; sprite = "internal:TRNGA0r";
width = 16; width = 16;
} }
309 309
{ {
title = "CTF Team Ring (Blue)"; title = "CTF Team Ring (Blue)";
sprite = "internal:BRNGA0"; sprite = "internal:TRNGA0b";
width = 16; width = 16;
} }
330 330
{ {
title = "Bounce Ring Panel"; title = "Bounce Ring Panel";
sprite = "internal:PIKBA0"; sprite = "PIKBA0";
} }
331 331
{ {
title = "Rail Ring Panel"; title = "Rail Ring Panel";
sprite = "internal:PIKRA0"; sprite = "PIKRA0";
} }
332 332
{ {
title = "Automatic Ring Panel"; title = "Automatic Ring Panel";
sprite = "internal:PIKAA0"; sprite = "PIKAA0";
} }
333 333
{ {
title = "Explosion Ring Panel"; title = "Explosion Ring Panel";
sprite = "internal:PIKEA0"; sprite = "PIKEA0";
} }
334 334
{ {
title = "Scatter Ring Panel"; title = "Scatter Ring Panel";
sprite = "internal:PIKSA0"; sprite = "PIKSA0";
} }
335 335
{ {
title = "Grenade Ring Panel"; title = "Grenade Ring Panel";
sprite = "internal:PIKGA0"; sprite = "PIKGA0";
} }
} }
@ -3986,6 +4116,7 @@ thingtypes
flags8height = 24; flags8height = 24;
flags8text = "[8] Float"; flags8text = "[8] Float";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
} }
@ -4000,6 +4131,7 @@ thingtypes
flags4text = "[4] Random (Strong)"; flags4text = "[4] Random (Strong)";
flags8text = "[8] Random (Weak)"; flags8text = "[8] Random (Weak)";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
400 400
{ {
@ -4131,6 +4263,7 @@ thingtypes
height = 44; height = 44;
flags1text = "[1] Run linedef executor on pop"; flags1text = "[1] Run linedef executor on pop";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
431 431
{ {
@ -4228,6 +4361,7 @@ thingtypes
height = 128; height = 128;
flags4text = "[4] Respawn at center"; flags4text = "[4] Respawn at center";
angletext = "Angle/Order"; angletext = "Angle/Order";
fixedrotation = 1;
parametertext = "Order"; parametertext = "Order";
} }
520 520
@ -4259,7 +4393,7 @@ thingtypes
flags1text = "[1] Start retracted"; flags1text = "[1] Start retracted";
flags4text = "[4] Retractable"; flags4text = "[4] Retractable";
flags8text = "[8] Intangible"; flags8text = "[8] Intangible";
parametertext = "Initial delay"; parametertext = "Start delay";
} }
523 523
{ {
@ -4271,7 +4405,8 @@ thingtypes
flags4text = "[4] Retractable"; flags4text = "[4] Retractable";
flags8text = "[8] Intangible"; flags8text = "[8] Intangible";
angletext = "Retraction interval"; angletext = "Retraction interval";
parametertext = "Initial delay"; fixedrotation = 1;
parametertext = "Start delay";
} }
1130 1130
{ {
@ -4320,6 +4455,7 @@ thingtypes
flags4text = "[4] Invisible"; flags4text = "[4] Invisible";
flags8text = "[8] No distance check"; flags8text = "[8] No distance check";
angletext = "Lift height"; angletext = "Lift height";
fixedrotation = 1;
} }
541 541
{ {
@ -4335,6 +4471,7 @@ thingtypes
width = 32; width = 32;
height = 64; height = 64;
angletext = "Strength"; angletext = "Strength";
fixedrotation = 1;
} }
543 543
{ {
@ -4344,6 +4481,7 @@ thingtypes
height = 64; height = 64;
flags8text = "[8] Respawn"; flags8text = "[8] Respawn";
angletext = "Color"; angletext = "Color";
fixedrotation = 1;
} }
550 550
{ {
@ -4617,6 +4755,9 @@ thingtypes
title = "Slope Vertex"; title = "Slope Vertex";
sprite = "internal:vertexslope"; sprite = "internal:vertexslope";
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
parametertext = "Absolute?";
flagsvaluetext = "Absolute Z";
} }
751 751
@ -4638,6 +4779,7 @@ thingtypes
title = "Zoom Tube Waypoint"; title = "Zoom Tube Waypoint";
sprite = "internal:zoom"; sprite = "internal:zoom";
angletext = "Order"; angletext = "Order";
fixedrotation = 1;
} }
754 754
@ -4647,6 +4789,7 @@ thingtypes
flags8text = "[8] Push using XYZ"; flags8text = "[8] Push using XYZ";
sprite = "GWLGA0"; sprite = "GWLGA0";
angletext = "Radius"; angletext = "Radius";
fixedrotation = 1;
} }
755 755
{ {
@ -4655,6 +4798,7 @@ thingtypes
flags8text = "[8] Pull using XYZ"; flags8text = "[8] Pull using XYZ";
sprite = "GWLRA0"; sprite = "GWLRA0";
angletext = "Radius"; angletext = "Radius";
fixedrotation = 1;
} }
756 756
{ {
@ -4663,6 +4807,7 @@ thingtypes
width = 32; width = 32;
height = 16; height = 16;
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
757 757
{ {
@ -4671,6 +4816,7 @@ thingtypes
width = 8; width = 8;
height = 16; height = 16;
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
758 758
{ {
@ -4681,21 +4827,24 @@ thingtypes
{ {
title = "PolyObject Anchor"; title = "PolyObject Anchor";
sprite = "internal:polyanchor"; sprite = "internal:polyanchor";
angletext = "ID"; angletext = "Tag";
fixedrotation = 1;
} }
761 761
{ {
title = "PolyObject Spawn Point"; title = "PolyObject Spawn Point";
sprite = "internal:polycenter"; sprite = "internal:polycenter";
angletext = "ID"; angletext = "Tag";
fixedrotation = 1;
} }
762 762
{ {
title = "PolyObject Spawn Point (Crush)"; title = "PolyObject Spawn Point (Crush)";
sprite = "internal:polycentercrush"; sprite = "internal:polycentercrush";
angletext = "ID"; angletext = "Tag";
fixedrotation = 1;
} }
780 780
{ {
@ -4703,6 +4852,7 @@ thingtypes
sprite = "internal:skyb"; sprite = "internal:skyb";
flags4text = "[4] In-map centerpoint"; flags4text = "[4] In-map centerpoint";
parametertext = "ID"; parametertext = "ID";
fixedrotation = 1;
} }
} }
@ -4897,6 +5047,7 @@ thingtypes
height = 16; height = 16;
hangs = 1; hangs = 1;
angletext = "Dripping interval"; angletext = "Dripping interval";
fixedrotation = 1;
} }
1003 1003
{ {
@ -4953,7 +5104,7 @@ thingtypes
1011 1011
{ {
title = "Stalagmite (DSZ2)"; title = "Stalagmite (DSZ2)";
sprite = "DSTGA0"; sprite = "DSTGB0";
width = 8; width = 8;
height = 116; height = 116;
flags4text = "[4] Double size"; flags4text = "[4] Double size";
@ -5038,6 +5189,8 @@ thingtypes
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
flags8text = "[8] Double size"; flags8text = "[8] Double size";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1105 1105
{ {
@ -5048,6 +5201,8 @@ thingtypes
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
flags8text = "[8] Double size"; flags8text = "[8] Double size";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1106 1106
{ {
@ -5058,6 +5213,8 @@ thingtypes
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
flags8text = "[8] Red spring"; flags8text = "[8] Red spring";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1107 1107
{ {
@ -5067,6 +5224,8 @@ thingtypes
height = 34; height = 34;
flags8text = "[8] Double size"; flags8text = "[8] Double size";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1108 1108
{ {
@ -5086,6 +5245,8 @@ thingtypes
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
flags8text = "[8] Double size"; flags8text = "[8] Double size";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1110 1110
{ {
@ -5095,6 +5256,8 @@ thingtypes
height = 34; height = 34;
flags4text = "[4] No sounds"; flags4text = "[4] No sounds";
angletext = "Tag"; angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
} }
1111 1111
{ {
@ -5224,6 +5387,7 @@ thingtypes
sprite = "EGR1A1"; sprite = "EGR1A1";
width = 20; width = 20;
height = 72; height = 72;
arrow = 1;
} }
1128 1128
{ {
@ -5272,6 +5436,7 @@ thingtypes
width = 8; width = 8;
height = 16; height = 16;
angletext = "Tag"; angletext = "Tag";
fixedrotation = 1;
} }
1203 1203
{ {
@ -5342,6 +5507,7 @@ thingtypes
sprite = "WWSGAR"; sprite = "WWSGAR";
width = 22; width = 22;
height = 64; height = 64;
arrow = 1;
} }
1213 1213
{ {
@ -5349,6 +5515,7 @@ thingtypes
sprite = "WWS2AR"; sprite = "WWS2AR";
width = 22; width = 22;
height = 64; height = 64;
arrow = 1;
} }
1214 1214
{ {
@ -5356,6 +5523,7 @@ thingtypes
sprite = "WWS3ALAR"; sprite = "WWS3ALAR";
width = 16; width = 16;
height = 192; height = 192;
arrow = 1;
} }
1215 1215
{ {
@ -5371,6 +5539,7 @@ thingtypes
sprite = "BARRA1"; sprite = "BARRA1";
width = 24; width = 24;
height = 63; height = 63;
arrow = 1;
} }
1217 1217
{ {
@ -5392,6 +5561,7 @@ thingtypes
sprite = "MCRTCLFR"; sprite = "MCRTCLFR";
width = 22; width = 22;
height = 32; height = 32;
arrow = 1;
} }
1220 1220
{ {
@ -5399,6 +5569,7 @@ thingtypes
sprite = "MCRTIR"; sprite = "MCRTIR";
width = 32; width = 32;
height = 32; height = 32;
arrow = 1;
} }
1221 1221
{ {
@ -5406,6 +5577,7 @@ thingtypes
sprite = "SALDARAL"; sprite = "SALDARAL";
width = 96; width = 96;
height = 160; height = 160;
arrow = 1;
flags8text = "[8] Allow non-minecart players"; flags8text = "[8] Allow non-minecart players";
} }
1222 1222
@ -5467,6 +5639,7 @@ thingtypes
height = 40; height = 40;
flags8text = "[8] Waves vertically"; flags8text = "[8] Waves vertically";
angletext = "On/Off time"; angletext = "On/Off time";
fixedrotation = 1;
parametertext = "Strength"; parametertext = "Strength";
} }
1301 1301
@ -5477,6 +5650,7 @@ thingtypes
height = 40; height = 40;
flags8text = "[8] Shoot downwards"; flags8text = "[8] Shoot downwards";
angletext = "On/Off time"; angletext = "On/Off time";
fixedrotation = 1;
parametertext = "Strength"; parametertext = "Strength";
} }
1302 1302
@ -5500,6 +5674,7 @@ thingtypes
width = 30; width = 30;
height = 32; height = 32;
angletext = "Initial delay"; angletext = "Initial delay";
fixedrotation = 1;
flags8text = "[8] Double size"; flags8text = "[8] Double size";
} }
1305 1305
@ -5537,6 +5712,7 @@ thingtypes
sprite = "WVINALAR"; sprite = "WVINALAR";
width = 1; width = 1;
height = 288; height = 288;
arrow = 1;
} }
1310 1310
{ {
@ -5544,6 +5720,7 @@ thingtypes
sprite = "WVINBLBR"; sprite = "WVINBLBR";
width = 1; width = 1;
height = 288; height = 288;
arrow = 1;
} }
} }
@ -5901,6 +6078,7 @@ thingtypes
width = 8; width = 8;
height = 4096; height = 4096;
sprite = "UNKNA0"; sprite = "UNKNA0";
fixedrotation = 1;
1700 1700
{ {
@ -5959,6 +6137,7 @@ thingtypes
flags4text = "[4] Align player to top"; flags4text = "[4] Align player to top";
flags8text = "[8] Die upon time up"; flags8text = "[8] Die upon time up";
angletext = "Time limit"; angletext = "Time limit";
fixedrotation = 1;
parametertext = "Height"; parametertext = "Height";
} }
1704 1704
@ -5971,6 +6150,7 @@ thingtypes
unflippable = true; unflippable = true;
flagsvaluetext = "Pitch"; flagsvaluetext = "Pitch";
angletext = "Yaw"; angletext = "Yaw";
fixedrotation = 1;
} }
1705 1705
{ {
@ -5983,6 +6163,7 @@ thingtypes
centerHitbox = true; centerHitbox = true;
flagsvaluetext = "Height"; flagsvaluetext = "Height";
angletext = "Pitch/Yaw"; angletext = "Pitch/Yaw";
fixedrotation = 1;
} }
1706 1706
{ {
@ -6104,6 +6285,7 @@ thingtypes
width = 8; width = 8;
height = 16; height = 16;
angletext = "Jump strength"; angletext = "Jump strength";
fixedrotation = 1;
} }
1806 1806
{ {
@ -6336,6 +6518,7 @@ thingtypes
width = 18; width = 18;
height = 28; height = 28;
angletext = "Initial delay"; angletext = "Initial delay";
fixedrotation = 1;
} }
2001 2001
{ {
@ -6459,6 +6642,7 @@ thingtypes
sprite = "XMS6A0"; sprite = "XMS6A0";
width = 52; width = 52;
height = 106; height = 106;
hangs = 1;
} }
} }
@ -6472,6 +6656,7 @@ thingtypes
flags4text = "[4] No movement"; flags4text = "[4] No movement";
flags8text = "[8] Hop"; flags8text = "[8] Hop";
angletext = "Radius"; angletext = "Radius";
fixedrotation = 1;
2200 2200
{ {

View file

@ -1247,6 +1247,7 @@ patterns
sprite = "SPHRA0"; sprite = "SPHRA0";
width = 96; width = 96;
height = 192; height = 192;
}
609 609
{ {
title = "Circle of Rings and Spheres (Big)"; title = "Circle of Rings and Spheres (Big)";

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 # SRB2 Core
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
# Core sources # Core sources
set(SRB2_CORE_SOURCES target_sourcefile(c)
am_map.c target_sources(SRB2SDL2 PRIVATE comptime.c md5.c config.h.in)
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
)
set(SRB2_CORE_HEADERS set(SRB2_ASM_SOURCES vid_copy.s)
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_NASM_SOURCES tmap_mmx.nas tmap.nas)
### Configuration ### Configuration
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
@ -268,91 +44,7 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).") "Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
endif() endif()
set(SRB2_LUA_SOURCES add_subdirectory(blua)
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_infolib.c
lua_maplib.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})
if(${SRB2_CONFIG_HAVE_GME}) if(${SRB2_CONFIG_HAVE_GME})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
@ -368,7 +60,7 @@ if(${SRB2_CONFIG_HAVE_GME})
endif() endif()
if(${GME_FOUND}) if(${GME_FOUND})
set(SRB2_HAVE_GME ON) set(SRB2_HAVE_GME ON)
add_definitions(-DHAVE_LIBGME) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
else() else()
message(WARNING "You have specified that GME is available but it was not found.") message(WARNING "You have specified that GME is available but it was not found.")
endif() endif()
@ -388,7 +80,7 @@ if(${SRB2_CONFIG_HAVE_OPENMPT})
endif() endif()
if(${OPENMPT_FOUND}) if(${OPENMPT_FOUND})
set(SRB2_HAVE_OPENMPT ON) set(SRB2_HAVE_OPENMPT ON)
add_definitions(-DHAVE_OPENMPT) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
else() else()
message(WARNING "You have specified that OpenMPT is available but it was not found.") message(WARNING "You have specified that OpenMPT is available but it was not found.")
endif() endif()
@ -411,8 +103,7 @@ if(${SRB2_CONFIG_HAVE_MIXERX})
endif() endif()
if(${MIXERX_FOUND}) if(${MIXERX_FOUND})
set(SRB2_HAVE_MIXERX ON) set(SRB2_HAVE_MIXERX ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXERX)
add_definitions(-DHAVE_MIXERX)
else() else()
message(WARNING "You have specified that SDL Mixer X is available but it was not found.") message(WARNING "You have specified that SDL Mixer X is available but it was not found.")
endif() endif()
@ -432,7 +123,7 @@ if(${SRB2_CONFIG_HAVE_ZLIB})
endif() endif()
if(${ZLIB_FOUND}) if(${ZLIB_FOUND})
set(SRB2_HAVE_ZLIB ON) set(SRB2_HAVE_ZLIB ON)
add_definitions(-DHAVE_ZLIB) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB)
else() else()
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2 may not compile correctly.") message(WARNING "You have specified that ZLIB is available but it was not found. SRB2 may not compile correctly.")
endif() endif()
@ -453,14 +144,9 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
endif() endif()
if(${PNG_FOUND}) if(${PNG_FOUND})
set(SRB2_HAVE_PNG ON) set(SRB2_HAVE_PNG ON)
add_definitions(-DHAVE_PNG) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_PNG)
add_definitions(-D_LARGEFILE64_SOURCE) target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
set(SRB2_PNG_SOURCES apng.c) target_sources(SRB2SDL2 PRIVATE 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})
else() else()
message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.") message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.")
endif() endif()
@ -481,7 +167,7 @@ if(${SRB2_CONFIG_HAVE_CURL})
endif() endif()
if(${CURL_FOUND}) if(${CURL_FOUND})
set(SRB2_HAVE_CURL ON) set(SRB2_HAVE_CURL ON)
add_definitions(-DHAVE_CURL) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_CURL)
else() else()
message(WARNING "You have specified that CURL is available but it was not found. SRB2 may not compile correctly.") message(WARNING "You have specified that CURL is available but it was not found. SRB2 may not compile correctly.")
endif() endif()
@ -489,59 +175,19 @@ endif()
if(${SRB2_CONFIG_HAVE_THREADS}) if(${SRB2_CONFIG_HAVE_THREADS})
set(SRB2_HAVE_THREADS ON) set(SRB2_HAVE_THREADS ON)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/i_threads.h) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
add_definitions(-DHAVE_THREADS)
endif() endif()
if(${SRB2_CONFIG_HWRENDER}) if(${SRB2_CONFIG_HWRENDER})
add_definitions(-DHWRENDER) target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
set(SRB2_HWRENDER_SOURCES add_subdirectory(hardware)
${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
)
endif() endif()
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL}) if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
find_package(OpenGL) find_package(OpenGL)
if(${OPENGL_FOUND}) if(${OPENGL_FOUND})
add_definitions(-DHWRENDER) target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
add_definitions(-DSTATIC_OPENGL) target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL)
else() else()
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.") message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
endif() endif()
@ -562,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.") set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
enable_language(ASM_NASM) enable_language(ASM_NASM)
endif() endif()
set(SRB2_USEASM ON) set(SRB2_USEASM ON)
add_definitions(-DUSEASM) target_compile_definitions(SRB2SDL2 PRIVATE -DUSEASM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -mfpmath=sse") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -mfpmath=sse")
target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES}
${SRB2_NASM_SOURCES})
else() else()
set(SRB2_USEASM OFF) set(SRB2_USEASM OFF)
add_definitions(-DNONX86 -DNORUSEASM) target_compile_definitions(SRB2SDL2 PRIVATE -DNONX86 -DNORUSEASM)
endif() endif()
# Targets # Targets
@ -603,7 +253,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
endif() endif()
add_definitions(-DCMAKECONFIG) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-trigraphs)
target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG)
#add_library(SRB2Core STATIC #add_library(SRB2Core STATIC
# ${SRB2_CORE_SOURCES} # ${SRB2_CORE_SOURCES}

File diff suppressed because it is too large Load diff

View file

@ -1,462 +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
ifeq (,$(filter GCC%,$(.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)))
$(info\
Your compiler version, GCC $(version), is not supported by the Makefile.\
The Makefile will assume GCC $(LATEST_GCC_VERSION).)
GCC$(subst .,,$(LATEST_GCC_VERSION))=1
else
$(info 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
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
#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
else
ifdef LINUX
NASMFORMAT=elf -DLINUX
SDL=1
ifdef LINUX64
OBJDIR:=$(OBJDIR)/Linux64
BIN:=$(BIN)/Linux64
else
OBJDIR:=$(OBJDIR)/Linux
BIN:=$(BIN)/Linux
endif
else
ifdef FREEBSD
INTERFACE=sdl
NASMFORMAT=elf -DLINUX
SDL=1
OBJDIR:=$(OBJDIR)/FreeBSD
BIN:=$(BIN)/FreeBSD
else
ifdef SOLARIS
INTERFACE=sdl
NASMFORMAT=elf -DLINUX
SDL=1
OBJDIR:=$(OBJDIR)/Solaris
BIN:=$(BIN)/Solaris
else
ifdef CYGWIN32
INTERFACE=sdl
NASMFORMAT=win32
SDL=1
OBJDIR:=$(OBJDIR)/cygwin
BIN:=$(BIN)/Cygwin
else
ifdef MINGW64
INTERFACE=win32
#NASMFORMAT=win64
OBJDIR:=$(OBJDIR)/Mingw64
BIN:=$(BIN)/Mingw64
else
ifdef MINGW
INTERFACE=win32
NASMFORMAT=win32
OBJDIR:=$(OBJDIR)/Mingw
BIN:=$(BIN)/Mingw
endif
endif
endif
endif
endif
endif
endif
ifdef ARCHNAME
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
BIN:=$(BIN)/$(ARCHNAME)
endif
OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)
ifdef SDL
INTERFACE=sdl
OBJDIR:=$(OBJDIR)/SDL
endif
ifndef DUMMY
ifdef DEBUGMODE
OBJDIR:=$(OBJDIR)/Debug
BIN:=$(BIN)/Debug
else
OBJDIR:=$(OBJDIR)/Release
BIN:=$(BIN)/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_LARGFILE64_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) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -458,7 +458,7 @@ boolean AM_Responder(event_t *ev)
{ {
if (!automapactive) 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 //faB: prevent alt-tab in win32 version to activate automap just before
// minimizing the app; doesn't do any harm to the DOS version // 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) else if (ev->type == ev_keydown)
{ {
rc = true; rc = true;
switch (ev->data1) switch (ev->key)
{ {
case AM_PANRIGHTKEY: // pan right case AM_PANRIGHTKEY: // pan right
if (!followplayer) if (!followplayer)
@ -550,7 +550,7 @@ boolean AM_Responder(event_t *ev)
else if (ev->type == ev_keyup) else if (ev->type == ev_keyup)
{ {
rc = false; rc = false;
switch (ev->data1) switch (ev->key)
{ {
case AM_PANRIGHTKEY: case AM_PANRIGHTKEY:
if (!followplayer) if (!followplayer)

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz. // Copyright (C) 2007-2016 by John "JTE" Muniz.
// Copyright (C) 2011-2020 by Sonic Team Junior. // Copyright (C) 2011-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -18,29 +18,38 @@
#include "b_bot.h" #include "b_bot.h"
#include "lua_hook.h" #include "lua_hook.h"
// If you want multiple bots, variables like this will void B_UpdateBotleader(player_t *player)
// 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)
{ {
jump_last = false; UINT32 i;
spin_last = false; fixed_t dist;
anxiety = 0; fixed_t neardist = INT32_MAX;
panic = false; player_t *nearplayer = NULL;
flymode = 0; //Find new botleader
spinmode = false; for (i = 0; i < MAXPLAYERS; i++)
thinkfly = false; {
if (players[i].bot || players[i].playerstate != PST_LIVE || players[i].spectator || !players[i].mo)
continue;
if (!player->mo) //Can't do distance calculations if there's no player object, so we'll just take the first we find
{
player->botleader = &players[i];
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) static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
@ -49,39 +58,47 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
player_t *player = sonic->player, *bot = tails->player; player_t *player = sonic->player, *bot = tails->player;
ticcmd_t *pcmd = &player->cmd; 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); SINT8 flip = P_MobjFlip(tails);
boolean _2d = (tails->flags2 & MF2_TWOD) || twodlevel; boolean _2d = (tails->flags2 & MF2_TWOD) || twodlevel;
fixed_t scale = tails->scale; 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 dist = P_AproxDistance(sonic->x - tails->x, sonic->y - tails->y);
fixed_t zdist = flip * (sonic->z - tails->z); fixed_t zdist = flip * (sonic->z - tails->z);
angle_t ang = sonic->angle; angle_t ang = sonic->angle;
fixed_t pmom = P_AproxDistance(sonic->momx, sonic->momy); fixed_t pmom = P_AproxDistance(sonic->momx, sonic->momy);
fixed_t bmom = P_AproxDistance(tails->momx, tails->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 followthres = 92 * scale; // Distance that AI will try to reach
fixed_t followmin = 32 * scale; fixed_t followmin = 32 * scale;
fixed_t comfortheight = 96 * scale; fixed_t comfortheight = 96 * scale;
fixed_t touchdist = 24 * 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 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 samepos = (sonic->x == tails->x && sonic->y == tails->y);
boolean blocked = bot->blocked;
if (!samepos) if (!samepos)
ang = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y); ang = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y);
// We can't follow Sonic if he's not around! // Lua can handle it!
if (!sonic || sonic->health <= 0) if (LUA_HookBotAI(sonic, tails, cmd))
return; return;
// Lua can handle it! // We can't follow Sonic if he's not around!
if (LUAh_BotAI(sonic, tails, cmd)) if (!sonic || sonic->health <= 0)
{
mem->thinkstate = AI_STANDBY;
return; 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) 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); 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) if (sonic->player->cmd.buttons & BT_JUMP && (sonic->player->pflags & PF_JUMPED) && isrelevant)
cmd->buttons |= BT_JUMP; cmd->buttons |= BT_JUMP;
if (isrelevant) if (isrelevant)
@ -103,56 +120,57 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
followmin = 0; followmin = 0;
followthres = 16*scale; followthres = 16*scale;
followmax >>= 1; followmax >>= 1;
thinkfly = false; if (mem->thinkstate == AI_THINKFLY)
mem->thinkstate = AI_FOLLOW;
} }
// Check anxiety // Update catchup_tics
if (spinmode) if (mem->thinkstate == AI_SPINFOLLOW)
{ {
anxiety = 0; mem-> catchup_tics = 0;
panic = false;
} }
else if (dist > followmax || zdist > comfortheight || stalled) else if (dist > followmax || zdist > comfortheight || stalled)
{ {
anxiety = min(anxiety + 2, 70); mem-> catchup_tics = min(mem-> catchup_tics + 2, 70);
if (anxiety >= 70) if (mem-> catchup_tics >= 70)
panic = true; mem->thinkstate = AI_CATCHUP;
} }
else else
{ {
anxiety = max(anxiety - 1, 0); mem-> catchup_tics = max(mem-> catchup_tics - 1, 0);
panic = false; if (mem->thinkstate == AI_CATCHUP)
mem->thinkstate = AI_FOLLOW;
} }
// Orientation // 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)) 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 else
{ {
cmd->angleturn = (ang - tails->angle) >> 16; // NOT FRACBITS DAMNIT cmd->angleturn = (ang) >> 16; // NOT FRACBITS DAMNIT
} }
// ******** // ********
// FLY MODE // FLY MODE
// spinmode check // exiting check
if (spinmode || player->exiting) if (player->exiting && mem->thinkstate == AI_THINKFLY)
thinkfly = false; mem->thinkstate = AI_FOLLOW;
else else
{ {
// Activate co-op flight // Activate co-op flight
if (thinkfly && player->pflags & PF_JUMPED) if (mem->thinkstate == AI_THINKFLY && player->pflags & PF_JUMPED)
{ {
if (!jump_last) if (!jump_last)
{ {
jump = true; jump = true;
flymode = 1; mem->thinkstate = AI_FLYSTANDBY;
thinkfly = false;
bot->pflags |= PF_CANCARRY; bot->pflags |= PF_CANCARRY;
} }
} }
@ -165,20 +183,19 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
&& P_IsObjectOnGround(sonic) && P_IsObjectOnGround(tails) && P_IsObjectOnGround(sonic) && P_IsObjectOnGround(tails)
&& !(player->pflags & PF_STASIS) && !(player->pflags & PF_STASIS)
&& bot->charability == CA_FLY) && bot->charability == CA_FLY)
thinkfly = true; mem->thinkstate = AI_THINKFLY;
else else if (mem->thinkstate == AI_THINKFLY)
thinkfly = false; mem->thinkstate = AI_FOLLOW;
// Set carried state // Set carried state
if (player->powers[pw_carry] == CR_PLAYER && sonic->tracer == tails) if (player->powers[pw_carry] == CR_PLAYER && sonic->tracer == tails)
{ {
flymode = 2; mem->thinkstate = AI_FLYCARRY;
} }
// Ready for takeoff // 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 if (zdist < -64*scale || (flip * tails->momz) > scale) // Make sure we're not too high up
spin = true; spin = true;
else if (!jump_last) else if (!jump_last)
@ -186,10 +203,10 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// Abort if the player moves away or spins // Abort if the player moves away or spins
if (dist > followthres || player->dashspeed) if (dist > followthres || player->dashspeed)
flymode = 0; mem->thinkstate = AI_FOLLOW;
} }
// Read player inputs while carrying // Read player inputs while carrying
else if (flymode == 2) else if (mem->thinkstate == AI_FLYCARRY)
{ {
cmd->forwardmove = pcmd->forwardmove; cmd->forwardmove = pcmd->forwardmove;
cmd->sidemove = pcmd->sidemove; cmd->sidemove = pcmd->sidemove;
@ -203,19 +220,19 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// End flymode // End flymode
if (player->powers[pw_carry] != CR_PLAYER) if (player->powers[pw_carry] != CR_PLAYER)
{ {
flymode = 0; mem->thinkstate = AI_FOLLOW;
} }
} }
} }
if (flymode && P_IsObjectOnGround(tails) && !(pcmd->buttons & BT_JUMP)) if (P_IsObjectOnGround(tails) && !(pcmd->buttons & BT_JUMP) && (mem->thinkstate == AI_FLYSTANDBY || mem->thinkstate == AI_FLYCARRY))
flymode = 0; mem->thinkstate = AI_FOLLOW;
// ******** // ********
// SPINNING // SPINNING
if (panic || flymode || !(player->pflags & PF_SPINNING) || (player->pflags & PF_JUMPED)) if (!(player->pflags & (PF_SPINNING|PF_STARTDASH)) && mem->thinkstate == AI_SPINFOLLOW)
spinmode = false; mem->thinkstate = AI_FOLLOW;
else else if (mem->thinkstate == AI_FOLLOW || mem->thinkstate == AI_SPINFOLLOW)
{ {
if (!_2d) if (!_2d)
{ {
@ -224,21 +241,21 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
{ {
if (dist < followthres && dist > touchdist) // Do positioning 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; cmd->forwardmove = 50;
spinmode = true; mem->thinkstate = AI_SPINFOLLOW;
} }
else if (dist < touchdist) else if (dist < touchdist)
{ {
if (!bmom && (!(bot->pflags & PF_SPINNING) || (bot->dashspeed && bot->pflags & PF_SPINNING))) 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; spin = true;
} }
spinmode = true; mem->thinkstate = AI_SPINFOLLOW;
} }
else else
spinmode = false; mem->thinkstate = AI_FOLLOW;
} }
// Spin // Spin
else if (player->dashspeed == bot->dashspeed && player->pflags & PF_SPINNING) else if (player->dashspeed == bot->dashspeed && player->pflags & PF_SPINNING)
@ -246,12 +263,12 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
if (bot->pflags & PF_SPINNING || !spin_last) if (bot->pflags & PF_SPINNING || !spin_last)
{ {
spin = true; spin = true;
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT cmd->angleturn = (sonic->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->forwardmove = MAXPLMOVE; cmd->forwardmove = MAXPLMOVE;
spinmode = true; mem->thinkstate = AI_SPINFOLLOW;
} }
else else
spinmode = false; mem->thinkstate = AI_FOLLOW;
} }
} }
// 2D mode // 2D mode
@ -261,17 +278,19 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
&& ((bot->pflags & PF_SPINNING) || !spin_last)) && ((bot->pflags & PF_SPINNING) || !spin_last))
{ {
spin = true; spin = true;
spinmode = true; mem->thinkstate = AI_SPINFOLLOW;
} }
else
mem->thinkstate = AI_FOLLOW;
} }
} }
// ******** // ********
// FOLLOW // FOLLOW
if (!(flymode || spinmode)) if (mem->thinkstate == AI_FOLLOW || mem->thinkstate == AI_CATCHUP)
{ {
// Too far // Too far
if (panic || dist > followthres) if (mem->thinkstate == AI_CATCHUP || dist > followthres)
{ {
if (!_2d) if (!_2d)
cmd->forwardmove = MAXPLMOVE; cmd->forwardmove = MAXPLMOVE;
@ -281,7 +300,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
cmd->sidemove = -MAXPLMOVE; cmd->sidemove = -MAXPLMOVE;
} }
// Within threshold // Within threshold
else if (!panic && dist > followmin && abs(zdist) < 192*scale) else if (dist > followmin && abs(zdist) < 192*scale)
{ {
if (!_2d) if (!_2d)
cmd->forwardmove = FixedHypot(pcmd->forwardmove, pcmd->sidemove); cmd->forwardmove = FixedHypot(pcmd->forwardmove, pcmd->sidemove);
@ -292,7 +311,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
else if (dist < followmin) else if (dist < followmin)
{ {
// Copy inputs // Copy inputs
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT cmd->angleturn = (sonic->angle) >> 16; // NOT FRACBITS DAMNIT
bot->drawangle = ang; bot->drawangle = ang;
cmd->forwardmove = 8 * pcmd->forwardmove / 10; cmd->forwardmove = 8 * pcmd->forwardmove / 10;
cmd->sidemove = 8 * pcmd->sidemove / 10; cmd->sidemove = 8 * pcmd->sidemove / 10;
@ -301,7 +320,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// ******** // ********
// JUMP // JUMP
if (!(flymode || spinmode)) if (mem->thinkstate == AI_FOLLOW || mem->thinkstate == AI_CATCHUP || (mem->thinkstate == AI_SPINFOLLOW && player->pflags & PF_JUMPED))
{ {
// Flying catch-up // Flying catch-up
if (bot->pflags & PF_THOKKED) if (bot->pflags & PF_THOKKED)
@ -319,31 +338,30 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// Start jump // Start jump
else if (!jump_last && !(bot->pflags & PF_JUMPED) //&& !(player->pflags & PF_SPINNING) else if (!jump_last && !(bot->pflags & PF_JUMPED) //&& !(player->pflags & PF_SPINNING)
&& ((zdist > 32*scale && player->pflags & PF_JUMPED) // Following && ((zdist > 32*scale && player->pflags & PF_JUMPED) // Following
|| (zdist > 64*scale && panic) // Vertical catch-up || (zdist > 64*scale && mem->thinkstate == AI_CATCHUP) // Vertical catch-up
|| (stalled && anxiety > 20 && bot->powers[pw_carry] == CR_NONE) || (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 //|| (bmom < scale>>3 && dist > followthres && !(bot->powers[pw_carry])) // Stopped & not in carry state
|| (bot->pflags & PF_SPINNING && !(bot->pflags & PF_JUMPED)))) // Spinning || (bot->pflags & PF_SPINNING && !(bot->pflags & PF_JUMPED)))) // Spinning
jump = true; jump = true;
// Hold jump // 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; jump = true;
// Start flying // 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; jump = true;
} }
// ******** // ********
// HISTORY // HISTORY
jump_last = jump; //jump_last = jump;
spin_last = spin; //spin_last = spin;
// Turn the virtual keypresses into ticcmd_t. // Turn the virtual keypresses into ticcmd_t.
B_KeysToTiccmd(tails, cmd, forward, backward, left, right, false, false, jump, spin); B_KeysToTiccmd(tails, cmd, forward, backward, left, right, false, false, jump, spin);
// Update our status // Update our status
lastForward = forward; mem->lastForward = forward;
lastBlocked = blocked; mem->lastBlocked = blocked;
blocked = false;
} }
void B_BuildTiccmd(player_t *player, ticcmd_t *cmd) void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
@ -363,25 +381,28 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
CV_SetValue(&cv_analog[1], false); CV_SetValue(&cv_analog[1], false);
// Let Lua scripts build ticcmds // Let Lua scripts build ticcmds
if (LUAh_BotTiccmd(player, cmd)) if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)))
return; return;
// We don't have any main character AI, sorry. D: // Make sure we have a valid main character to follow
if (player-players == consoleplayer) B_UpdateBotleader(player);
if (!player->botleader)
return; return;
// Basic Tails AI // Single Player Tails AI
B_BuildTailsTiccmd(players[consoleplayer].mo, player->mo, cmd); //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) 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 // 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; return;
// Turn the virtual keypresses into ticcmd_t. // Turn the virtual keypresses into ticcmd_t.
if (twodlevel || mo->flags2 & MF2_TWOD) { if (twodlevel || mo->flags2 & MF2_TWOD) {
if (players[consoleplayer].climbing if (player->botleader->climbing
|| mo->player->pflags & PF_GLIDING) { || mo->player->pflags & PF_GLIDING) {
// Don't mess with bot inputs during these unhandled movement conditions. // 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. // The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
@ -420,7 +441,7 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16; cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
if (backward) if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16; cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
if (left) if (left)
cmd->angleturn += 1280; cmd->angleturn += 1280;
if (right) if (right)
cmd->angleturn -= 1280; cmd->angleturn -= 1280;
@ -447,21 +468,26 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
void B_MoveBlocked(player_t *player) void B_MoveBlocked(player_t *player)
{ {
(void)player; (void)player;
blocked = true; player->blocked = true;
} }
boolean B_CheckRespawn(player_t *player) boolean B_CheckRespawn(player_t *player)
{ {
mobj_t *sonic = players[consoleplayer].mo; mobj_t *sonic;
mobj_t *tails = player->mo; 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! // We can't follow Sonic if he's not around!
if (!sonic || sonic->health <= 0) if (!sonic || sonic->health <= 0)
return false; return false;
// B_RespawnBot doesn't do anything if the condition above this isn't met // 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)) if (P_MobjWasRemoved(sonic) || P_MobjWasRemoved(tails))
return (shouldForce == 1); // mobj was removed return (shouldForce == 1); // mobj was removed
@ -505,15 +531,19 @@ void B_RespawnBot(INT32 playernum)
{ {
player_t *player = &players[playernum]; player_t *player = &players[playernum];
fixed_t x,y,z; fixed_t x,y,z;
mobj_t *sonic = players[consoleplayer].mo; mobj_t *sonic;
mobj_t *tails; mobj_t *tails;
if (!player->botleader)
return;
sonic = player->botleader->mo;
if (!sonic || sonic->health <= 0) if (!sonic || sonic->health <= 0)
return; return;
B_ResetAI(); B_ResetAI(&player->botmem);
player->bot = 1; player->bot = BOT_2PAI;
P_SpawnPlayer(playernum); P_SpawnPlayer(playernum);
tails = player->mo; tails = player->mo;
@ -540,10 +570,6 @@ void B_RespawnBot(INT32 playernum)
player->powers[pw_spacetime] = sonic->player->powers[pw_spacetime]; player->powers[pw_spacetime] = sonic->player->powers[pw_spacetime];
player->powers[pw_gravityboots] = sonic->player->powers[pw_gravityboots]; player->powers[pw_gravityboots] = sonic->player->powers[pw_gravityboots];
player->powers[pw_nocontrol] = sonic->player->powers[pw_nocontrol]; 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); player->pflags |= PF_AUTOBRAKE|(sonic->player->pflags & PF_DIRECTIONCHAR);
P_TeleportMove(tails, x, y, z); P_TeleportMove(tails, x, y, z);
@ -561,11 +587,11 @@ void B_RespawnBot(INT32 playernum)
void B_HandleFlightIndicator(player_t *player) void B_HandleFlightIndicator(player_t *player)
{ {
mobj_t *tails = player->mo; mobj_t *tails = player->mo;
botmem_t *mem = &player->botmem;
if (!tails) if (!tails)
return; return;
if (thinkfly && player->bot == 1 && tails->health) if (mem->thinkstate == AI_THINKFLY && player->bot == BOT_2PAI && tails->health)
{ {
if (!tails->hnext) if (!tails->hnext)
{ {

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz. // Copyright (C) 2007-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2020 by Sonic Team Junior. // Copyright (C) 2012-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -10,6 +10,7 @@
/// \file b_bot.h /// \file b_bot.h
/// \brief Basic bot handling /// \brief Basic bot handling
void B_UpdateBotleader(player_t *player);
void B_BuildTiccmd(player_t *player, ticcmd_t *cmd); 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); 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); boolean B_CheckRespawn(player_t *player);

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

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

View file

@ -1,52 +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_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; UINT16 lumpnum;
int n = lua_gettop(L); 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"); luaL_error(L, "dofile() only works with PK3 files");
snprintf(fullfilename, sizeof(fullfilename), "Lua/%s", filename); snprintf(fullfilename, sizeof(fullfilename), "Lua/%s", filename);

View file

@ -686,6 +686,15 @@ static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {
} }
static void codeunaryarith (FuncState *fs, OpCode op, expdesc *e) {
expdesc e2;
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
if (op == OP_LEN || !isnumeral(e))
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
codearith(fs, op, e, &e2);
}
static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
expdesc *e2) { expdesc *e2) {
int o1 = luaK_exp2RK(fs, e1); int o1 = luaK_exp2RK(fs, e1);
@ -703,27 +712,11 @@ static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
expdesc e2;
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
switch (op) { switch (op) {
case OPR_MINUS: { case OPR_MINUS: codeunaryarith(fs, OP_UNM, e); break;
if (!isnumeral(e)) case OPR_BNOT: codeunaryarith(fs, OP_BNOT, e); break;
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
codearith(fs, OP_UNM, e, &e2);
break;
}
case OPR_BNOT: {
if (e->k == VK)
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
codearith(fs, OP_BNOT, e, &e2);
break;
}
case OPR_NOT: codenot(fs, e); break; case OPR_NOT: codenot(fs, e); break;
case OPR_LEN: { case OPR_LEN: codeunaryarith(fs, OP_LEN, e); break;
luaK_exp2anyreg(fs, e); /* cannot operate on constants */
codearith(fs, OP_LEN, e, &e2);
break;
}
default: lua_assert(0); default: lua_assert(0);
} }
} }

View file

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

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -650,7 +650,7 @@ static void COM_ExecuteString(char *ptext)
else else
{ // Monster Iestyn: keep track of how many levels of recursion we're in { // Monster Iestyn: keep track of how many levels of recursion we're in
recursion++; recursion++;
COM_BufInsertText(a->value); COM_BufInsertTextEx(a->value, com_flags);
recursion--; recursion--;
} }
return; return;
@ -1433,6 +1433,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
if (var->revert.allocated) if (var->revert.allocated)
{ {
Z_Free(var->revert.v.string); Z_Free(var->revert.v.string);
var->revert.allocated = false; // the below value is not allocated in zone memory, don't try to free it!
} }
var->revert.v.const_munge = var->PossibleValue[i].strvalue; var->revert.v.const_munge = var->PossibleValue[i].strvalue;
@ -1440,6 +1441,10 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
return; return;
} }
// free the old value string
Z_Free(var->zstring);
var->zstring = NULL;
var->value = var->PossibleValue[i].value; var->value = var->PossibleValue[i].value;
var->string = var->PossibleValue[i].strvalue; var->string = var->PossibleValue[i].strvalue;
goto finish; goto finish;
@ -1502,13 +1507,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
found: found:
if (client && execversion_enabled) if (client && execversion_enabled)
{ {
if (var->revert.allocated)
{
Z_Free(var->revert.v.string);
}
var->revert.v.const_munge = var->PossibleValue[i].strvalue; var->revert.v.const_munge = var->PossibleValue[i].strvalue;
return; return;
} }
@ -1523,6 +1522,7 @@ found:
if (var->revert.allocated) if (var->revert.allocated)
{ {
Z_Free(var->revert.v.string); Z_Free(var->revert.v.string);
// Z_StrDup creates a new zone memory block, so we can keep the allocated flag on
} }
var->revert.v.string = Z_StrDup(valstr); var->revert.v.string = Z_StrDup(valstr);
@ -1577,7 +1577,7 @@ finish:
} }
var->flags |= CV_MODIFIED; var->flags |= CV_MODIFIED;
// raise 'on change' code // raise 'on change' code
LUA_CVarChanged(var->name); // let consolelib know what cvar this is. LUA_CVarChanged(var); // let consolelib know what cvar this is.
if (var->flags & CV_CALL && !stealth) if (var->flags & CV_CALL && !stealth)
var->func(); var->func();
@ -1738,6 +1738,8 @@ void CV_SaveVars(UINT8 **p, boolean in_demo)
static void CV_LoadVars(UINT8 **p, static void CV_LoadVars(UINT8 **p,
consvar_t *(*got)(UINT8 **p, char **ret_value, boolean *ret_stealth)) consvar_t *(*got)(UINT8 **p, char **ret_value, boolean *ret_stealth))
{ {
const boolean store = (client || demoplayback);
consvar_t *cvar; consvar_t *cvar;
UINT16 count; UINT16 count;
@ -1751,7 +1753,7 @@ static void CV_LoadVars(UINT8 **p,
{ {
if (cvar->flags & CV_NETVAR) 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.v.const_munge = cvar->string;
cvar->revert.allocated = ( cvar->zstring != NULL ); cvar->revert.allocated = ( cvar->zstring != NULL );
@ -1787,6 +1789,7 @@ void CV_RevertNetVars(void)
if (cvar->revert.allocated) if (cvar->revert.allocated)
{ {
Z_Free(cvar->revert.v.string); Z_Free(cvar->revert.v.string);
cvar->revert.allocated = false; // no value being held now
} }
cvar->revert.v.string = NULL; cvar->revert.v.string = NULL;
@ -2363,7 +2366,10 @@ static boolean CV_Command(void)
return false; return false;
if (( com_flags & COM_SAFE ) && ( v->flags & CV_NOLUA )) 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 // perform a variable print or set
if (COM_Argc() == 1) if (COM_Argc() == 1)

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -158,7 +158,7 @@ typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NUL
/* name, defaultvalue, flags, PossibleValue, func */ /* name, defaultvalue, flags, PossibleValue, func */
#define CVAR_INIT( ... ) \ #define CVAR_INIT( ... ) \
{ __VA_ARGS__, 0, NULL, NULL, {0}, 0U, (char)0, NULL } { __VA_ARGS__, 0, NULL, NULL, {0, {NULL}}, 0U, (char)0, NULL }
#ifdef OLD22DEMOCOMPAT #ifdef OLD22DEMOCOMPAT
typedef struct old_demo_var old_demo_var_t; typedef struct old_demo_var old_demo_var_t;

View file

@ -34,12 +34,13 @@
* Last updated 2020 / 07 / 10 - v2.2.6 - player.dta & patch.pk3 * Last updated 2020 / 07 / 10 - v2.2.6 - player.dta & patch.pk3
* Last updated 2020 / 09 / 27 - v2.2.7 - patch.pk3 * Last updated 2020 / 09 / 27 - v2.2.7 - patch.pk3
* Last updated 2020 / 10 / 02 - v2.2.8 - patch.pk3 * Last updated 2020 / 10 / 02 - v2.2.8 - patch.pk3
* Last updated 2021 / 05 / 06 - v2.2.9 - patch.pk3 & zones.pk3
*/ */
#define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" #define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28"
#define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead" #define ASSET_HASH_ZONES_PK3 "f8f3e2b5deacf40f14e36686a07d44bb"
#define ASSET_HASH_PLAYER_DTA "49dad7b24634c89728cc3e0b689e12bb" #define ASSET_HASH_PLAYER_DTA "49dad7b24634c89728cc3e0b689e12bb"
#ifdef USE_PATCH_DTA #ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_PK3 "466cdf60075262b3f5baa5e07f0999e8" #define ASSET_HASH_PATCH_PK3 "7d467a883f7887b3c311798ee2f56b6a"
#endif #endif
#endif #endif

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -221,7 +221,7 @@ static void CONS_Bind_f(void)
for (key = 0; key < NUMINPUTS; key++) for (key = 0; key < NUMINPUTS; key++)
if (bindtable[key]) if (bindtable[key])
{ {
CONS_Printf("%s : \"%s\"\n", G_KeynumToString(key), bindtable[key]); CONS_Printf("%s : \"%s\"\n", G_KeyNumToName(key), bindtable[key]);
na = 1; na = 1;
} }
if (!na) if (!na)
@ -229,7 +229,7 @@ static void CONS_Bind_f(void)
return; return;
} }
key = G_KeyStringtoNum(COM_Argv(1)); key = G_KeyNameToNum(COM_Argv(1));
if (key <= 0 || key >= NUMINPUTS) if (key <= 0 || key >= NUMINPUTS)
{ {
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n")); CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
@ -360,30 +360,48 @@ static void CON_SetupColormaps(void)
for (i = 0; i < (256*15); i++, ++memorysrc) for (i = 0; i < (256*15); i++, ++memorysrc)
*memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself...
#define colset(map, a, b, c) \ #define colset(map, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
map[1] = (UINT8)a;\ map[0x0] = (UINT8)a;\
map[3] = (UINT8)b;\ map[0x1] = (UINT8)b;\
map[9] = (UINT8)c map[0x2] = (UINT8)c;\
map[0x3] = (UINT8)d;\
map[0x4] = (UINT8)e;\
map[0x5] = (UINT8)f;\
map[0x6] = (UINT8)g;\
map[0x7] = (UINT8)h;\
map[0x8] = (UINT8)i;\
map[0x9] = (UINT8)j;\
map[0xA] = (UINT8)k;\
map[0xB] = (UINT8)l;\
map[0xC] = (UINT8)m;\
map[0xD] = (UINT8)n;\
map[0xE] = (UINT8)o;\
map[0xF] = (UINT8)p;
colset(magentamap, 177, 178, 184); // Tried to keep the colors vanilla while adding some shades in between them ~SonicX8000
colset(yellowmap, 82, 73, 66);
colset(lgreenmap, 97, 98, 106); // 0x1 0x3 0x9 0xF
colset(bluemap, 146, 147, 155); colset(magentamap, 177, 177, 178, 178, 178, 180, 180, 180, 182, 182, 182, 182, 184, 184, 184, 185);
colset(redmap, 210, 32, 39); colset(yellowmap, 82, 82, 73, 73, 73, 64, 64, 64, 66, 66, 66, 66, 67, 67, 67, 68);
colset(graymap, 6, 8, 14); colset(lgreenmap, 96, 96, 98, 98, 98, 101, 101, 101, 104, 104, 104, 104, 106, 106, 106, 107);
colset(orangemap, 51, 52, 57); colset(bluemap, 146, 146, 147, 147, 147, 149, 149, 149, 152, 152, 152, 152, 155, 155, 155, 157);
colset(skymap, 129, 130, 133); colset(redmap, 32, 32, 33, 33, 33, 35, 35, 35, 39, 39, 39, 39, 42, 42, 42, 44);
colset(purplemap, 160, 161, 163); colset(graymap, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
colset(aquamap, 120, 121, 123); colset(orangemap, 50, 50, 52, 52, 52, 54, 54, 54, 56, 56, 56, 56, 59, 59, 59, 60);
colset(peridotmap, 88, 188, 190); colset(skymap, 129, 129, 130, 130, 130, 131, 131, 131, 133, 133, 133, 133, 135, 135, 135, 136);
colset(azuremap, 144, 145, 170); colset(purplemap, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165);
colset(brownmap, 219, 221, 224); colset(aquamap, 120, 120, 121, 121, 121, 122, 122, 122, 123, 123, 123, 123, 124, 124, 124, 125);
colset(rosymap, 200, 201, 203); colset(peridotmap, 72, 72, 188, 188, 189, 189, 189, 189, 190, 190, 190, 190, 191, 191, 191, 94);
colset(invertmap, 27, 26, 22); colset(azuremap, 144, 144, 145, 145, 145, 146, 146, 146, 170, 170, 170, 170, 171, 171, 171, 172);
invertmap[26] = (UINT8)3; colset(brownmap, 219, 219, 221, 221, 221, 222, 222, 222, 224, 224, 224, 224, 227, 227, 227, 229);
colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 202, 203, 203, 203, 203, 204, 204, 204, 205);
#undef colset #undef colset
// Yeah just straight up invert it like a normal person
for (i = 0x00; i <= 0x1F; i++)
invertmap[0x1F - i] = i;
// Init back colormap // Init back colormap
CON_SetupBackColormap(); CON_SetupBackColormap();
} }
@ -466,6 +484,19 @@ void CON_Init(void)
Unlock_state(); Unlock_state();
} }
} }
void CON_StartRefresh(void)
{
if (con_startup)
con_refresh = true;
}
void CON_StopRefresh(void)
{
if (con_startup)
con_refresh = false;
}
// Console input initialization // Console input initialization
// //
static void CON_InputInit(void) static void CON_InputInit(void)
@ -808,6 +839,12 @@ static void CON_InputDelSelection(void)
Lock_state(); Lock_state();
if (!input_cur)
{
Unlock_state();
return;
}
if (input_cur > input_sel) if (input_cur > input_sel)
{ {
start = input_sel; start = input_sel;
@ -889,12 +926,12 @@ boolean CON_Responder(event_t *ev)
// let go keyup events, don't eat them // let go keyup events, don't eat them
if (ev->type != ev_keydown && ev->type != ev_console) if (ev->type != ev_keydown && ev->type != ev_console)
{ {
if (ev->data1 == gamecontrol[gc_console][0] || ev->data1 == gamecontrol[gc_console][1]) if (ev->key == gamecontrol[GC_CONSOLE][0] || ev->key == gamecontrol[GC_CONSOLE][1])
consdown = false; consdown = false;
return false; return false;
} }
key = ev->data1; key = ev->key;
// check for console toggle key // check for console toggle key
if (ev->type != ev_console) if (ev->type != ev_console)
@ -902,7 +939,7 @@ boolean CON_Responder(event_t *ev)
if (modeattacking || metalrecording || marathonmode) if (modeattacking || metalrecording || marathonmode)
return false; return false;
if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1]) if (key == gamecontrol[GC_CONSOLE][0] || key == gamecontrol[GC_CONSOLE][1])
{ {
if (consdown) // ignore repeat if (consdown) // ignore repeat
return true; return true;
@ -1279,10 +1316,6 @@ boolean CON_Responder(event_t *ev)
if (key < 32 || key > 127) if (key < 32 || key > 127)
return true; return true;
// add key to cmd line here
if (key >= 'A' && key <= 'Z' && !(shiftdown ^ capslock)) //this is only really necessary for dedicated servers
key = key + 'a' - 'A';
if (input_sel != input_cur) if (input_sel != input_cur)
CON_InputDelSelection(); CON_InputDelSelection();
CON_InputAddChar(key); CON_InputAddChar(key);
@ -1677,7 +1710,10 @@ static void CON_DrawHudlines(void)
{ {
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT; charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
p++; p++;
c++;
} }
if (c >= con_width)
break;
if (*p < HU_FONTSTART) if (*p < HU_FONTSTART)
;//charwidth = 4 * con_scalefactor; ;//charwidth = 4 * con_scalefactor;
else else
@ -1736,8 +1772,8 @@ static void CON_DrawBackpic(void)
} }
// Draw the patch. // Draw the patch.
V_DrawCroppedPatch(x << FRACBITS, 0, FRACUNIT, V_NOSCALESTART, con_backpic, V_DrawCroppedPatch(x << FRACBITS, 0, FRACUNIT, FRACUNIT, V_NOSCALESTART, con_backpic, NULL,
0, ( BASEVIDHEIGHT - h ), BASEVIDWIDTH, h); 0, (BASEVIDHEIGHT - h) << FRACBITS, BASEVIDWIDTH << FRACBITS, h << FRACBITS);
// Unlock the cached patch. // Unlock the cached patch.
W_UnlockCachedPatch(con_backpic); W_UnlockCachedPatch(con_backpic);
@ -1798,7 +1834,10 @@ static void CON_DrawConsole(void)
{ {
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT; charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
p++; p++;
c++;
} }
if (c >= con_width)
break;
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true); V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true);
} }
} }

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -16,6 +16,9 @@
void CON_Init(void); void CON_Init(void);
void CON_StartRefresh(void);
void CON_StopRefresh(void);
boolean CON_Responder(event_t *ev); boolean CON_Responder(event_t *ev);
#ifdef HAVE_THREADS #ifdef HAVE_THREADS

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -22,11 +22,15 @@
#include "mserv.h" #include "mserv.h"
/* /*
The 'packet version' is used to distinguish packet formats. The 'packet version' is used to distinguish packet
This version is independent of VERSION and SUBVERSION. Different formats. This version is independent of VERSION and
applications may follow different packet versions. SUBVERSION. Different applications may follow different
packet versions.
If you change the struct or the meaning of a field
therein, increment this number.
*/ */
#define PACKETVERSION 3 #define PACKETVERSION 4
// Network play related stuff. // Network play related stuff.
// There is a data struct that stores network // There is a data struct that stores network
@ -90,6 +94,9 @@ typedef enum
PT_LOGIN, // Login attempt from the client. PT_LOGIN, // Login attempt from the client.
PT_TELLFILESNEEDED, // Client, to server: "what other files do I need starting from this number?"
PT_MOREFILESNEEDED, // Server, to client: "you need these (+ more on top of those)"
PT_PING, // Packet sent to tell clients the other client's latency to server. PT_PING, // Packet sent to tell clients the other client's latency to server.
NUMPACKETTYPE NUMPACKETTYPE
} packettype_t; } packettype_t;
@ -141,9 +148,6 @@ typedef struct
typedef struct typedef struct
{ {
UINT8 version; // Different versions don't work
UINT8 subversion; // Contains build version
// Server launch stuffs // Server launch stuffs
UINT8 serverplayer; UINT8 serverplayer;
UINT8 totalslotnum; // "Slots": highest player number in use plus one. UINT8 totalslotnum; // "Slots": highest player number in use plus one.
@ -190,16 +194,22 @@ typedef struct
typedef struct typedef struct
{ {
UINT8 _255;/* see serverinfo_pak */ UINT8 modversion;
UINT8 packetversion;
char application[MAXAPPLICATION]; char application[MAXAPPLICATION];
UINT8 version; // Different versions don't work
UINT8 subversion; // Contains build version
UINT8 localplayers; UINT8 localplayers;
UINT8 mode; UINT8 mode;
char names[MAXSPLITSCREENPLAYERS][MAXPLAYERNAME]; char names[MAXSPLITSCREENPLAYERS][MAXPLAYERNAME];
} ATTRPACK clientconfig_pak; } ATTRPACK clientconfig_pak;
#define SV_DEDICATED 0x40 // server is dedicated
#define SV_LOTSOFADDONS 0x20 // flag used to ask for full file list in d_netfil
enum {
REFUSE_JOINS_DISABLED = 1,
REFUSE_SLOTS_FULL,
REFUSE_BANNED,
};
#define MAXSERVERNAME 32 #define MAXSERVERNAME 32
#define MAXFILENEEDED 915 #define MAXFILENEEDED 915
// This packet is too large // This packet is too large
@ -217,11 +227,11 @@ typedef struct
UINT8 subversion; UINT8 subversion;
UINT8 numberofplayer; UINT8 numberofplayer;
UINT8 maxplayer; UINT8 maxplayer;
UINT8 refusereason; // 0: joinable, 1: joins disabled, 2: full UINT8 refusereason; // 0: joinable, REFUSE enum
char gametypename[24]; char gametypename[24];
UINT8 modifiedgame; UINT8 modifiedgame;
UINT8 cheatsenabled; UINT8 cheatsenabled;
UINT8 isdedicated; UINT8 flags;
UINT8 fileneedednum; UINT8 fileneedednum;
tic_t time; tic_t time;
tic_t leveltime; tic_t leveltime;
@ -275,6 +285,14 @@ typedef struct
UINT8 ctfteam; UINT8 ctfteam;
} ATTRPACK plrconfig; } ATTRPACK plrconfig;
typedef struct
{
INT32 first;
UINT8 num;
UINT8 more;
UINT8 files[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
} ATTRPACK filesneededconfig_pak;
// //
// Network packet data // Network packet data
// //
@ -304,6 +322,8 @@ typedef struct
msaskinfo_pak msaskinfo; // 22 bytes msaskinfo_pak msaskinfo; // 22 bytes
plrinfo playerinfo[MAXPLAYERS]; // 576 bytes(?) plrinfo playerinfo[MAXPLAYERS]; // 576 bytes(?)
plrconfig playerconfig[MAXPLAYERS]; // (up to) 528 bytes(?) plrconfig playerconfig[MAXPLAYERS]; // (up to) 528 bytes(?)
INT32 filesneedednum; // 4 bytes
filesneededconfig_pak filesneededcfg; // ??? bytes
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
} u; // This is needed to pack diff packet types data together } u; // This is needed to pack diff packet types data together
} ATTRPACK doomdata_t; } ATTRPACK doomdata_t;
@ -401,6 +421,7 @@ void CL_Reset(void);
void CL_ClearPlayer(INT32 playernum); void CL_ClearPlayer(INT32 playernum);
void CL_QueryServerList(msg_server_t *list); void CL_QueryServerList(msg_server_t *list);
void CL_UpdateServerList(boolean internetsearch, INT32 room); void CL_UpdateServerList(boolean internetsearch, INT32 room);
void CL_RemovePlayer(INT32 playernum, kickreason_t reason);
// Is there a game running // Is there a game running
boolean Playing(void); boolean Playing(void);

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -33,9 +33,10 @@ typedef enum
typedef struct typedef struct
{ {
evtype_t type; evtype_t type;
INT32 data1; // keys / mouse/joystick buttons INT32 key; // keys/mouse/joystick buttons
INT32 data2; // mouse/joystick x move INT32 x; // mouse/joystick x move
INT32 data3; // mouse/joystick y move INT32 y; // mouse/joystick y move
boolean repeated; // key repeat
} event_t; } event_t;
// //

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -15,7 +15,7 @@
/// plus functions to parse command line parameters, configure game /// plus functions to parse command line parameters, configure game
/// parameters, and call the startup functions. /// parameters, and call the startup functions.
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -61,11 +61,11 @@
#include "p_local.h" // chasecam #include "p_local.h" // chasecam
#include "mserv.h" // ms_RoomId #include "mserv.h" // ms_RoomId
#include "m_misc.h" // screenshot functionality #include "m_misc.h" // screenshot functionality
#include "dehacked.h" // Dehacked list test #include "deh_tables.h" // Dehacked list test
#include "m_cond.h" // condition initialization #include "m_cond.h" // condition initialization
#include "fastcmp.h" #include "fastcmp.h"
#include "keys.h" #include "keys.h"
#include "filesrch.h" // refreshdirmenu, mainwadstally #include "filesrch.h" // refreshdirmenu
#include "g_input.h" // tutorial mode control scheming #include "g_input.h" // tutorial mode control scheming
#include "m_perfstats.h" #include "m_perfstats.h"
@ -96,11 +96,8 @@ int SUBVERSION;
// platform independant focus loss // platform independant focus loss
UINT8 window_notinfocus = false; UINT8 window_notinfocus = false;
// static addfilelist_t startupwadfiles;
// DEMO LOOP static addfilelist_t startuppwads;
//
static char *startupwadfiles[MAX_WADFILES];
static char *startuppwads[MAX_WADFILES];
boolean devparm = false; // started game with -devparm boolean devparm = false; // started game with -devparm
@ -119,6 +116,9 @@ boolean midi_disabled = false;
boolean sound_disabled = false; boolean sound_disabled = false;
boolean digital_disabled = false; boolean digital_disabled = false;
//
// DEMO LOOP
//
boolean advancedemo; boolean advancedemo;
#ifdef DEBUGFILE #ifdef DEBUGFILE
INT32 debugload = 0; INT32 debugload = 0;
@ -175,10 +175,53 @@ void D_ProcessEvents(void)
boolean eaten; boolean eaten;
// Reset possibly stale mouse info
G_SetMouseDeltas(0, 0, 1);
G_SetMouseDeltas(0, 0, 2);
mouse.buttons &= ~(MB_SCROLLUP|MB_SCROLLDOWN);
mouse2.buttons &= ~(MB_SCROLLUP|MB_SCROLLDOWN);
for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1)) for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1))
{ {
boolean hooked = false;
ev = &events[eventtail]; ev = &events[eventtail];
// Set mouse buttons early in case event is eaten later
if (ev->type == ev_keydown || ev->type == ev_keyup)
{
// Mouse buttons
if ((UINT32)(ev->key - KEY_MOUSE1) < MOUSEBUTTONS)
{
if (ev->type == ev_keydown)
mouse.buttons |= 1 << (ev->key - KEY_MOUSE1);
else
mouse.buttons &= ~(1 << (ev->key - KEY_MOUSE1));
}
else if ((UINT32)(ev->key - KEY_2MOUSE1) < MOUSEBUTTONS)
{
if (ev->type == ev_keydown)
mouse2.buttons |= 1 << (ev->key - KEY_2MOUSE1);
else
mouse2.buttons &= ~(1 << (ev->key - KEY_2MOUSE1));
}
// Scroll (has no keyup event)
else switch (ev->key) {
case KEY_MOUSEWHEELUP:
mouse.buttons |= MB_SCROLLUP;
break;
case KEY_MOUSEWHEELDOWN:
mouse.buttons |= MB_SCROLLDOWN;
break;
case KEY_2MOUSEWHEELUP:
mouse2.buttons |= MB_SCROLLUP;
break;
case KEY_2MOUSEWHEELDOWN:
mouse2.buttons |= MB_SCROLLDOWN;
break;
}
}
// Screenshots over everything so that they can be taken anywhere. // Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev)) if (M_ScreenshotResponder(ev))
continue; // ate the event continue; // ate the event
@ -189,6 +232,12 @@ void D_ProcessEvents(void)
continue; continue;
} }
if (!CON_Ready() && !menuactive) {
if (G_LuaResponder(ev))
continue;
hooked = true;
}
// Menu input // Menu input
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex); I_lock_mutex(&m_menu_mutex);
@ -203,6 +252,12 @@ void D_ProcessEvents(void)
if (eaten) if (eaten)
continue; // menu ate the event continue; // menu ate the event
if (!hooked && !CON_Ready()) {
if (G_LuaResponder(ev))
continue;
hooked = true;
}
// console input // console input
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
I_lock_mutex(&con_mutex); I_lock_mutex(&con_mutex);
@ -217,8 +272,16 @@ void D_ProcessEvents(void)
if (eaten) if (eaten)
continue; // ate the event continue; // ate the event
if (!hooked && !CON_Ready() && G_LuaResponder(ev))
continue;
G_Responder(ev); G_Responder(ev);
} }
if (mouse.rdx || mouse.rdy)
G_SetMouseDeltas(mouse.rdx, mouse.rdy, 1);
if (mouse2.rdx || mouse2.rdy)
G_SetMouseDeltas(mouse2.rdx, mouse2.rdy, 2);
} }
// //
@ -413,7 +476,7 @@ static void D_Display(void)
if (!automapactive && !dedicated && cv_renderview.value) if (!automapactive && !dedicated && cv_renderview.value)
{ {
ps_rendercalltime = I_GetTimeMicros(); PS_START_TIMING(ps_rendercalltime);
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
{ {
topleft = screens[0] + viewwindowy*vid.width + viewwindowx; topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
@ -460,7 +523,7 @@ static void D_Display(void)
if (postimgtype2) if (postimgtype2)
V_DoPostProcessor(1, postimgtype2, postimgparam2); V_DoPostProcessor(1, postimgtype2, postimgparam2);
} }
ps_rendercalltime = I_GetTimeMicros() - ps_rendercalltime; PS_STOP_TIMING(ps_rendercalltime);
} }
if (lastdraw) if (lastdraw)
@ -474,7 +537,7 @@ static void D_Display(void)
lastdraw = false; lastdraw = false;
} }
ps_uitime = I_GetTimeMicros(); PS_START_TIMING(ps_uitime);
if (gamestate == GS_LEVEL) if (gamestate == GS_LEVEL)
{ {
@ -487,7 +550,7 @@ static void D_Display(void)
} }
else else
{ {
ps_uitime = I_GetTimeMicros(); PS_START_TIMING(ps_uitime);
} }
} }
@ -529,7 +592,7 @@ static void D_Display(void)
CON_Drawer(); CON_Drawer();
ps_uitime = I_GetTimeMicros() - ps_uitime; PS_STOP_TIMING(ps_uitime);
// //
// wipe update // wipe update
@ -615,9 +678,9 @@ static void D_Display(void)
M_DrawPerfStats(); M_DrawPerfStats();
} }
ps_swaptime = I_GetTimeMicros(); PS_START_TIMING(ps_swaptime);
I_FinishUpdate(); // page flip or blit buffer I_FinishUpdate(); // page flip or blit buffer
ps_swaptime = I_GetTimeMicros() - ps_swaptime; PS_STOP_TIMING(ps_swaptime);
} }
} }
@ -860,35 +923,68 @@ void D_StartTitle(void)
tutorialmode = false; tutorialmode = false;
} }
// #define REALLOC_FILE_LIST \
// D_AddFile if (list->files == NULL) \
// { \
static void D_AddFile(char **list, const char *file) list->files = calloc(sizeof(list->files), 2); \
{ list->numfiles = 1; \
size_t pnumwadfiles; } \
char *newfile; else \
{ \
index = list->numfiles; \
list->files = realloc(list->files, sizeof(list->files) * ((++list->numfiles) + 1)); \
if (list->files == NULL) \
I_Error("%s: No more free memory to add file %s", __FUNCTION__, file); \
}
for (pnumwadfiles = 0; list[pnumwadfiles]; pnumwadfiles++) static void D_AddFile(addfilelist_t *list, const char *file)
; {
char *newfile;
size_t index = 0;
REALLOC_FILE_LIST
newfile = malloc(strlen(file) + 1); newfile = malloc(strlen(file) + 1);
if (!newfile) if (!newfile)
{ I_Error("D_AddFile: No more free memory to add file %s", file);
I_Error("No more free memory to AddFile %s",file);
}
strcpy(newfile, file);
list[pnumwadfiles] = newfile; strcpy(newfile, file);
list->files[index] = newfile;
} }
static inline void D_CleanFile(char **list) static void D_AddFolder(addfilelist_t *list, const char *file)
{ {
size_t pnumwadfiles; char *newfile;
for (pnumwadfiles = 0; list[pnumwadfiles]; pnumwadfiles++) size_t index = 0;
REALLOC_FILE_LIST
newfile = malloc(strlen(file) + 2); // Path delimiter + NULL terminator
if (!newfile)
I_Error("D_AddFolder: No more free memory to add folder %s", file);
strcpy(newfile, file);
strcat(newfile, PATHSEP);
list->files[index] = newfile;
}
#undef REALLOC_FILE_LIST
static inline void D_CleanFile(addfilelist_t *list)
{
if (list->files)
{ {
free(list[pnumwadfiles]); size_t pnumwadfiles = 0;
list[pnumwadfiles] = NULL;
for (; pnumwadfiles < list->numfiles; pnumwadfiles++)
free(list->files[pnumwadfiles]);
free(list->files);
list->files = NULL;
} }
list->numfiles = 0;
} }
///\brief Checks if a netgame URL is being handled, and changes working directory to the EXE's if so. ///\brief Checks if a netgame URL is being handled, and changes working directory to the EXE's if so.
@ -934,7 +1030,7 @@ static void IdentifyVersion(void)
char *srb2wad; char *srb2wad;
const char *srb2waddir = NULL; const char *srb2waddir = NULL;
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
// change to the directory where 'srb2.pk3' is found // change to the directory where 'srb2.pk3' is found
srb2waddir = I_LocateWad(); srb2waddir = I_LocateWad();
#endif #endif
@ -972,7 +1068,7 @@ static void IdentifyVersion(void)
// Load the IWAD // Load the IWAD
if (srb2wad != NULL && FIL_ReadFileOK(srb2wad)) if (srb2wad != NULL && FIL_ReadFileOK(srb2wad))
D_AddFile(startupwadfiles, srb2wad); D_AddFile(&startupwadfiles, srb2wad);
else else
I_Error("srb2.pk3 not found! Expected in %s, ss file: %s\n", srb2waddir, srb2wad); I_Error("srb2.pk3 not found! Expected in %s, ss file: %s\n", srb2waddir, srb2wad);
@ -983,14 +1079,14 @@ static void IdentifyVersion(void)
// checking in D_SRB2Main // checking in D_SRB2Main
// Add the maps // Add the maps
D_AddFile(startupwadfiles, va(pandf,srb2waddir,"zones.pk3")); D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "zones.pk3"));
// Add the players // Add the players
D_AddFile(startupwadfiles, va(pandf,srb2waddir, "player.dta")); D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "player.dta"));
#ifdef USE_PATCH_DTA #ifdef USE_PATCH_DTA
// Add our crappy patches to fix our bugs // Add our crappy patches to fix our bugs
D_AddFile(startupwadfiles, va(pandf,srb2waddir,"patch.pk3")); D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "patch.pk3"));
#endif #endif
#if !defined (HAVE_SDL) || defined (HAVE_MIXER) #if !defined (HAVE_SDL) || defined (HAVE_MIXER)
@ -998,9 +1094,9 @@ static void IdentifyVersion(void)
#define MUSICTEST(str) \ #define MUSICTEST(str) \
{\ {\
const char *musicpath = va(pandf,srb2waddir,str);\ const char *musicpath = va(pandf,srb2waddir,str);\
int ms = W_VerifyNMUSlumps(musicpath); \ int ms = W_VerifyNMUSlumps(musicpath, false); \
if (ms == 1) \ if (ms == 1) \
D_AddFile(startupwadfiles, musicpath); \ D_AddFile(&startupwadfiles, musicpath); \
else if (ms == 0) \ else if (ms == 0) \
I_Error("File "str" has been modified with non-music/sound lumps"); \ I_Error("File "str" has been modified with non-music/sound lumps"); \
} }
@ -1045,7 +1141,7 @@ void D_SRB2Main(void)
// Print GPL notice for our console users (Linux) // Print GPL notice for our console users (Linux)
CONS_Printf( CONS_Printf(
"\n\nSonic Robo Blast 2\n" "\n\nSonic Robo Blast 2\n"
"Copyright (C) 1998-2020 by Sonic Team Junior\n\n" "Copyright (C) 1998-2021 by Sonic Team Junior\n\n"
"This program comes with ABSOLUTELY NO WARRANTY.\n\n" "This program comes with ABSOLUTELY NO WARRANTY.\n\n"
"This is free software, and you are welcome to redistribute it\n" "This is free software, and you are welcome to redistribute it\n"
"and/or modify it under the terms of the GNU General Public License\n" "and/or modify it under the terms of the GNU General Public License\n"
@ -1072,7 +1168,7 @@ void D_SRB2Main(void)
G_LoadGameSettings(); G_LoadGameSettings();
// Test Dehacked lists // Test Dehacked lists
DEH_Check(); DEH_TableCheck();
// Netgame URL special case: change working dir to EXE folder. // Netgame URL special case: change working dir to EXE folder.
ChangeDirForUrlHandler(); ChangeDirForUrlHandler();
@ -1107,7 +1203,7 @@ void D_SRB2Main(void)
if (!userhome) if (!userhome)
{ {
#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) #if (defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)
I_Error("Please set $HOME to your home directory\n"); I_Error("Please set $HOME to your home directory\n");
#else #else
if (dedicated) if (dedicated)
@ -1174,25 +1270,25 @@ void D_SRB2Main(void)
// Do this up here so that WADs loaded through the command line can use ExecCfg // Do this up here so that WADs loaded through the command line can use ExecCfg
COM_Init(); COM_Init();
// add any files specified on the command line with -file wadfile // Add any files specified on the command line with
// to the wad list // "-file <file>" or "-folder <folder>" to the add-on list
if (!((M_GetUrlProtocolArg() || M_CheckParm("-connect")) && !M_CheckParm("-server"))) if (!((M_GetUrlProtocolArg() || M_CheckParm("-connect")) && !M_CheckParm("-server")))
{ {
if (M_CheckParm("-file")) INT32 addontype = 0;
{ INT32 i;
// the parms after p are wadfile/lump names,
// until end of parms or another - preceded parm
while (M_IsNextParm())
{
const char *s = M_GetNextParm();
if (s) // Check for NULL? for (i = 1; i < myargc; i++)
{ {
if (!W_VerifyNMUSlumps(s)) if (!strcasecmp(myargv[i], "-file"))
G_SetGameModified(true); addontype = 1;
D_AddFile(startuppwads, s); else if (!strcasecmp(myargv[i], "-folder"))
} addontype = 2;
} else if (myargv[i][0] == '-' || myargv[i][0] == '+')
addontype = 0;
else if (addontype == 1)
D_AddFile(&startuppwads, myargv[i]);
else if (addontype == 2)
D_AddFolder(&startuppwads, myargv[i]);
} }
} }
@ -1231,8 +1327,8 @@ void D_SRB2Main(void)
// load wad, including the main wad file // load wad, including the main wad file
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n"); CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
W_InitMultipleFiles(startupwadfiles); W_InitMultipleFiles(&startupwadfiles);
D_CleanFile(startupwadfiles); D_CleanFile(&startupwadfiles);
#ifndef DEVELOP // md5s last updated 22/02/20 (ddmmyy) #ifndef DEVELOP // md5s last updated 22/02/20 (ddmmyy)
@ -1247,8 +1343,6 @@ void D_SRB2Main(void)
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
#endif //ifndef DEVELOP #endif //ifndef DEVELOP
mainwadstally = packetsizetally; // technically not accurate atm, remember to port the two-stage -file process from kart in 2.2.x
cht_Init(); cht_Init();
//---------------------------------------------------- READY SCREEN //---------------------------------------------------- READY SCREEN
@ -1279,9 +1373,16 @@ void D_SRB2Main(void)
I_RegisterSysCommands(); I_RegisterSysCommands();
CONS_Printf("W_InitMultipleFiles(): Adding extra PWADs.\n"); CON_StopRefresh(); // Temporarily stop refreshing the screen for wad loading
W_InitMultipleFiles(startuppwads);
D_CleanFile(startuppwads); if (startuppwads.numfiles)
{
CONS_Printf("W_InitMultipleFiles(): Adding extra PWADs.\n");
W_InitMultipleFiles(&startuppwads);
D_CleanFile(&startuppwads);
}
CON_StartRefresh(); // Restart the refresh!
CONS_Printf("HU_LoadGraphics()...\n"); CONS_Printf("HU_LoadGraphics()...\n");
HU_LoadGraphics(); HU_LoadGraphics();
@ -1291,7 +1392,7 @@ void D_SRB2Main(void)
G_LoadGameData(); G_LoadGameData();
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
#endif #endif
@ -1557,7 +1658,7 @@ const char *D_Home(void)
userhome = M_GetNextParm(); userhome = M_GetNextParm();
else else
{ {
#if !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) #if !(defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON))
if (FIL_FileOK(CONFIGFILENAME)) if (FIL_FileOK(CONFIGFILENAME))
usehome = false; // Let's NOT use home usehome = false; // Let's NOT use home
else else

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -40,10 +40,6 @@ void D_SRB2Main(void);
// Called by IO functions when input is detected. // Called by IO functions when input is detected.
void D_PostEvent(const event_t *ev); void D_PostEvent(const event_t *ev);
#if defined (PC_DOS) && !defined (DOXYGEN)
void D_PostEvent_end(void); // delimiter for locking memory
#endif
void D_ProcessEvents(void); void D_ProcessEvents(void);
const char *D_Home(void); const char *D_Home(void);

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -815,6 +815,8 @@ static const char *packettypename[NUMPACKETTYPE] =
"CLIENTJOIN", "CLIENTJOIN",
"NODETIMEOUT", "NODETIMEOUT",
"LOGIN", "LOGIN",
"TELLFILESNEEDED",
"MOREFILESNEEDED",
"PING" "PING"
}; };

View file

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

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -47,6 +47,7 @@
#include "m_cond.h" #include "m_cond.h"
#include "m_anigif.h" #include "m_anigif.h"
#include "md5.h" #include "md5.h"
#include "m_perfstats.h"
#ifdef NETGAME_DEVMODE #ifdef NETGAME_DEVMODE
#define CV_RESTRICT CV_NETVAR #define CV_RESTRICT CV_NETVAR
@ -63,7 +64,9 @@ static void Got_WeaponPref(UINT8 **cp, INT32 playernum);
static void Got_Mapcmd(UINT8 **cp, INT32 playernum); static void Got_Mapcmd(UINT8 **cp, INT32 playernum);
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum); static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum);
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum); static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum);
static void Got_RequestAddfoldercmd(UINT8 **cp, INT32 playernum);
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum); static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
static void Got_Addfoldercmd(UINT8 **cp, INT32 playernum);
static void Got_Pause(UINT8 **cp, INT32 playernum); static void Got_Pause(UINT8 **cp, INT32 playernum);
static void Got_Suicide(UINT8 **cp, INT32 playernum); static void Got_Suicide(UINT8 **cp, INT32 playernum);
static void Got_RandomSeed(UINT8 **cp, INT32 playernum); static void Got_RandomSeed(UINT8 **cp, INT32 playernum);
@ -115,6 +118,7 @@ static void Command_Map_f(void);
static void Command_ResetCamera_f(void); static void Command_ResetCamera_f(void);
static void Command_Addfile(void); static void Command_Addfile(void);
static void Command_Addfolder(void);
static void Command_ListWADS_f(void); static void Command_ListWADS_f(void);
static void Command_RunSOC(void); static void Command_RunSOC(void);
static void Command_Pause(void); static void Command_Pause(void);
@ -168,7 +172,7 @@ void SendWeaponPref(void);
void SendWeaponPref2(void); void SendWeaponPref2(void);
static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}}; static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}};
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"}, static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"},
{2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}}; {2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}};
#else #else
@ -214,11 +218,9 @@ consvar_t cv_respawntime = CVAR_INIT ("respawndelay", "3", CV_SAVE|CV_NETVAR|CV_
consvar_t cv_competitionboxes = CVAR_INIT ("competitionboxes", "Mystery", CV_SAVE|CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL); consvar_t cv_competitionboxes = CVAR_INIT ("competitionboxes", "Mystery", CV_SAVE|CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL);
#ifdef SEENAMES
static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}}; static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}};
consvar_t cv_seenames = CVAR_INIT ("seenames", "Ally/Foe", CV_SAVE, seenames_cons_t, 0); consvar_t cv_seenames = CVAR_INIT ("seenames", "Ally/Foe", CV_SAVE, seenames_cons_t, 0);
consvar_t cv_allowseenames = CVAR_INIT ("allowseenames", "Yes", CV_SAVE|CV_NETVAR, CV_YesNo, NULL); consvar_t cv_allowseenames = CVAR_INIT ("allowseenames", "Yes", CV_SAVE|CV_NETVAR, CV_YesNo, NULL);
#endif
// names // names
consvar_t cv_playername = CVAR_INIT ("name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange); consvar_t cv_playername = CVAR_INIT ("name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange);
@ -257,7 +259,7 @@ consvar_t cv_joyscale2 = CVAR_INIT ("padscale2", "1", CV_SAVE|CV_CALL, NULL, I_J
consvar_t cv_joyscale = CVAR_INIT ("padscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save consvar_t cv_joyscale = CVAR_INIT ("padscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save
consvar_t cv_joyscale2 = CVAR_INIT ("padscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save consvar_t cv_joyscale2 = CVAR_INIT ("padscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save
#endif #endif
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
consvar_t cv_mouse2port = CVAR_INIT ("mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL); consvar_t cv_mouse2port = CVAR_INIT ("mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL);
consvar_t cv_mouse2opt = CVAR_INIT ("mouse2opt", "0", CV_SAVE, NULL, NULL); consvar_t cv_mouse2opt = CVAR_INIT ("mouse2opt", "0", CV_SAVE, NULL, NULL);
#else #else
@ -286,7 +288,7 @@ consvar_t cv_gravity = CVAR_INIT ("gravity", "0.5", CV_RESTRICT|CV_FLOAT|CV_CALL
consvar_t cv_soundtest = CVAR_INIT ("soundtest", "0", CV_CALL, NULL, SoundTest_OnChange); consvar_t cv_soundtest = CVAR_INIT ("soundtest", "0", CV_CALL, NULL, SoundTest_OnChange);
static CV_PossibleValue_t minitimelimit_cons_t[] = {{15, "MIN"}, {9999, "MAX"}, {0, NULL}}; static CV_PossibleValue_t minitimelimit_cons_t[] = {{1, "MIN"}, {9999, "MAX"}, {0, NULL}};
consvar_t cv_countdowntime = CVAR_INIT ("countdowntime", "60", CV_SAVE|CV_NETVAR|CV_CHEAT, minitimelimit_cons_t, NULL); consvar_t cv_countdowntime = CVAR_INIT ("countdowntime", "60", CV_SAVE|CV_NETVAR|CV_CHEAT, minitimelimit_cons_t, NULL);
consvar_t cv_touchtag = CVAR_INIT ("touchtag", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL); consvar_t cv_touchtag = CVAR_INIT ("touchtag", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL);
@ -373,7 +375,14 @@ consvar_t cv_sleep = CVAR_INIT ("cpusleep", "1", CV_SAVE, sleeping_cons_t, NULL)
static CV_PossibleValue_t perfstats_cons_t[] = { static CV_PossibleValue_t perfstats_cons_t[] = {
{0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {0, NULL}}; {0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {0, NULL}};
consvar_t cv_perfstats = CVAR_INIT ("perfstats", "Off", 0, perfstats_cons_t, NULL); consvar_t cv_perfstats = CVAR_INIT ("perfstats", "Off", CV_CALL, perfstats_cons_t, PS_PerfStats_OnChange);
static CV_PossibleValue_t ps_samplesize_cons_t[] = {
{1, "MIN"}, {1000, "MAX"}, {0, NULL}};
consvar_t cv_ps_samplesize = CVAR_INIT ("ps_samplesize", "1", CV_CALL, ps_samplesize_cons_t, PS_SampleSize_OnChange);
static CV_PossibleValue_t ps_descriptor_cons_t[] = {
{1, "Average"}, {2, "SD"}, {3, "Minimum"}, {4, "Maximum"}, {0, NULL}};
consvar_t cv_ps_descriptor = CVAR_INIT ("ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL);
consvar_t cv_freedemocamera = CVAR_INIT("freedemocamera", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_freedemocamera = CVAR_INIT("freedemocamera", "Off", CV_SAVE, CV_OnOff, NULL);
char timedemo_name[256]; char timedemo_name[256];
@ -400,16 +409,16 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"MAP", "MAP",
"EXITLEVEL", "EXITLEVEL",
"ADDFILE", "ADDFILE",
"ADDFOLDER",
"PAUSE", "PAUSE",
"ADDPLAYER", "ADDPLAYER",
"TEAMCHANGE", "TEAMCHANGE",
"CLEARSCORES", "CLEARSCORES",
"LOGIN",
"VERIFIED", "VERIFIED",
"RANDOMSEED", "RANDOMSEED",
"RUNSOC", "RUNSOC",
"REQADDFILE", "REQADDFILE",
"DELFILE", // replace next time we add an XD "REQADDFOLDER",
"SETMOTD", "SETMOTD",
"SUICIDE", "SUICIDE",
"LUACMD", "LUACMD",
@ -443,7 +452,9 @@ void D_RegisterServerCommands(void)
RegisterNetXCmd(XD_MAP, Got_Mapcmd); RegisterNetXCmd(XD_MAP, Got_Mapcmd);
RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd); RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd);
RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd); RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd);
RegisterNetXCmd(XD_ADDFOLDER, Got_Addfoldercmd);
RegisterNetXCmd(XD_REQADDFILE, Got_RequestAddfilecmd); RegisterNetXCmd(XD_REQADDFILE, Got_RequestAddfilecmd);
RegisterNetXCmd(XD_REQADDFOLDER, Got_RequestAddfoldercmd);
RegisterNetXCmd(XD_PAUSE, Got_Pause); RegisterNetXCmd(XD_PAUSE, Got_Pause);
RegisterNetXCmd(XD_SUICIDE, Got_Suicide); RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd); RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
@ -474,6 +485,7 @@ void D_RegisterServerCommands(void)
COM_AddCommand("showmap", Command_Showmap_f); COM_AddCommand("showmap", Command_Showmap_f);
COM_AddCommand("mapmd5", Command_Mapmd5_f); COM_AddCommand("mapmd5", Command_Mapmd5_f);
COM_AddCommand("addfolder", Command_Addfolder);
COM_AddCommand("addfile", Command_Addfile); COM_AddCommand("addfile", Command_Addfile);
COM_AddCommand("listwad", Command_ListWADS_f); COM_AddCommand("listwad", Command_ListWADS_f);
@ -597,9 +609,7 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_pingtimeout); CV_RegisterVar(&cv_pingtimeout);
CV_RegisterVar(&cv_showping); CV_RegisterVar(&cv_showping);
#ifdef SEENAMES CV_RegisterVar(&cv_allowseenames);
CV_RegisterVar(&cv_allowseenames);
#endif
CV_RegisterVar(&cv_dummyconsvar); CV_RegisterVar(&cv_dummyconsvar);
} }
@ -670,6 +680,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_zlib_strategya); CV_RegisterVar(&cv_zlib_strategya);
CV_RegisterVar(&cv_zlib_window_bitsa); CV_RegisterVar(&cv_zlib_window_bitsa);
CV_RegisterVar(&cv_apng_delay); CV_RegisterVar(&cv_apng_delay);
CV_RegisterVar(&cv_apng_downscale);
// GIF variables // GIF variables
CV_RegisterVar(&cv_gif_optimize); CV_RegisterVar(&cv_gif_optimize);
CV_RegisterVar(&cv_gif_downscale); CV_RegisterVar(&cv_gif_downscale);
@ -690,9 +701,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_defaultplayercolor2); CV_RegisterVar(&cv_defaultplayercolor2);
CV_RegisterVar(&cv_defaultskin2); CV_RegisterVar(&cv_defaultskin2);
#ifdef SEENAMES
CV_RegisterVar(&cv_seenames); CV_RegisterVar(&cv_seenames);
#endif
CV_RegisterVar(&cv_rollingdemos); CV_RegisterVar(&cv_rollingdemos);
CV_RegisterVar(&cv_netstat); CV_RegisterVar(&cv_netstat);
CV_RegisterVar(&cv_netticbuffer); CV_RegisterVar(&cv_netticbuffer);
@ -793,7 +802,7 @@ void D_RegisterClientCommands(void)
// WARNING: the order is important when initialising mouse2 // WARNING: the order is important when initialising mouse2
// we need the mouse2port // we need the mouse2port
CV_RegisterVar(&cv_mouse2port); CV_RegisterVar(&cv_mouse2port);
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
CV_RegisterVar(&cv_mouse2opt); CV_RegisterVar(&cv_mouse2opt);
#endif #endif
CV_RegisterVar(&cv_controlperkey); CV_RegisterVar(&cv_controlperkey);
@ -866,6 +875,8 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_soundtest); CV_RegisterVar(&cv_soundtest);
CV_RegisterVar(&cv_perfstats); CV_RegisterVar(&cv_perfstats);
CV_RegisterVar(&cv_ps_samplesize);
CV_RegisterVar(&cv_ps_descriptor);
// ingame object placing // ingame object placing
COM_AddCommand("objectplace", Command_ObjectPlace_f); COM_AddCommand("objectplace", Command_ObjectPlace_f);
@ -1318,8 +1329,9 @@ static void SendNameAndColor(void)
cv_skin.value = R_SkinAvailable(cv_skin.string); cv_skin.value = R_SkinAvailable(cv_skin.string);
if ((cv_skin.value < 0) || !R_SkinUsable(consoleplayer, cv_skin.value)) if ((cv_skin.value < 0) || !R_SkinUsable(consoleplayer, cv_skin.value))
{ {
CV_StealthSet(&cv_skin, DEFAULTSKIN); INT32 defaultSkinNum = GetPlayerDefaultSkin(consoleplayer);
cv_skin.value = 0; CV_StealthSet(&cv_skin, skins[defaultSkinNum].name);
cv_skin.value = defaultSkinNum;
} }
// Finally write out the complete packet and send it off. // Finally write out the complete packet and send it off.
@ -1480,7 +1492,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer])) if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]))
{ {
boolean kick = false; boolean kick = false;
INT32 s; UINT32 unlockShift = 0;
UINT32 i;
// team colors // team colors
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
@ -1496,12 +1509,29 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
kick = true; kick = true;
// availabilities // availabilities
for (s = 0; s < MAXSKINS; s++) for (i = 0; i < MAXUNLOCKABLES; i++)
{ {
if (!skins[s].availability && (p->availabilities & (1 << s))) if (unlockables[i].type != SECRET_SKIN)
{
continue;
}
unlockShift++;
}
// If they set an invalid bit to true, then likely a modified client
if (unlockShift < 32) // 32 is the max the data type allows
{
UINT32 illegalMask = UINT32_MAX;
for (i = 0; i < unlockShift; i++)
{
illegalMask &= ~(1 << i);
}
if ((p->availabilities & illegalMask) != 0)
{ {
kick = true; kick = true;
break;
} }
} }
@ -2103,7 +2133,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
} }
mapnumber = M_MapNumber(mapname[3], mapname[4]); mapnumber = M_MapNumber(mapname[3], mapname[4]);
LUAh_MapChange(mapnumber); LUA_HookInt(mapnumber, HOOK(MapChange));
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS); G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
if (demoplayback && !timingdemo) if (demoplayback && !timingdemo)
@ -2135,7 +2165,7 @@ static void Command_Pause(void)
if (cv_pause.value || server || (IsPlayerAdmin(consoleplayer))) if (cv_pause.value || server || (IsPlayerAdmin(consoleplayer)))
{ {
if (modeattacking || !(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION)) if (modeattacking || !(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) || (marathonmode && gamestate == GS_INTERMISSION))
{ {
CONS_Printf(M_GetText("You can't pause here.\n")); CONS_Printf(M_GetText("You can't pause here.\n"));
return; return;
@ -2688,7 +2718,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
} }
// Don't switch team, just go away, please, go awaayyyy, aaauuauugghhhghgh // Don't switch team, just go away, please, go awaayyyy, aaauuauugghhhghgh
if (!LUAh_TeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled)) if (!LUA_HookTeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled))
return; return;
//no status changes after hidetime //no status changes after hidetime
@ -2849,7 +2879,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
// Call ViewpointSwitch hooks here. // Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed. // The viewpoint was forcibly changed.
if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal. if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal.
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true); LUA_HookViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
displayplayer = consoleplayer; displayplayer = consoleplayer;
} }
@ -3203,7 +3233,7 @@ static void Command_RunSOC(void)
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum) static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
{ {
char filename[256]; char filename[256];
filestatus_t ncs = FS_NOTFOUND; filestatus_t ncs = FS_NOTCHECKED;
if (playernum != serverplayer && !IsPlayerAdmin(playernum)) if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{ {
@ -3294,7 +3324,13 @@ static void Command_Addfile(void)
if (!isprint(fn[i]) || fn[i] == ';') if (!isprint(fn[i]) || fn[i] == ';')
return; return;
musiconly = W_VerifyNMUSlumps(fn); musiconly = W_VerifyNMUSlumps(fn, false);
if (musiconly == -1)
{
addedfiles[numfilesadded++] = fn;
continue;
}
if (!musiconly) if (!musiconly)
{ {
@ -3321,10 +3357,9 @@ static void Command_Addfile(void)
break; break;
++p; ++p;
// check total packet size and no of files currently loaded // check no of files currently loaded
// See W_LoadWadFile in w_wad.c // See W_LoadWadFile in w_wad.c
if ((numwadfiles >= MAX_WADFILES) if (numwadfiles >= MAX_WADFILES)
|| ((packetsizetally + nameonlylength(fn) + 22) > MAXFILENEEDED*sizeof(UINT8)))
{ {
CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn); CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn);
return; return;
@ -3353,6 +3388,9 @@ static void Command_Addfile(void)
for (i = 0; i < numwadfiles; i++) for (i = 0; i < numwadfiles; i++)
{ {
if (wadfiles[i]->type == RET_FOLDER)
continue;
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16)) if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
{ {
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn); CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
@ -3372,10 +3410,142 @@ static void Command_Addfile(void)
} }
} }
static void Command_Addfolder(void)
{
size_t argc = COM_Argc(); // amount of arguments total
size_t curarg; // current argument index
const char *addedfolders[argc]; // list of filenames already processed
size_t numfoldersadded = 0; // the amount of filenames processed
if (argc < 2)
{
CONS_Printf(M_GetText("addfolder <path> [path2...] [...]: Load add-ons\n"));
return;
}
// start at one to skip command name
for (curarg = 1; curarg < argc; curarg++)
{
const char *fn, *p;
char *fullpath;
char buf[256];
char *buf_p = buf;
INT32 i, stat;
size_t ii;
boolean folderadded = false;
fn = COM_Argv(curarg);
// For the amount of filenames previously processed...
for (ii = 0; ii < numfoldersadded; ii++)
{
// If this is one of them, don't try to add it.
if (!strcmp(fn, addedfolders[ii]))
{
folderadded = true;
break;
}
}
// If we've added this one, skip to the next one.
if (folderadded)
{
CONS_Alert(CONS_WARNING, M_GetText("Already processed %s, skipping\n"), fn);
continue;
}
// Disallow non-printing characters and semicolons.
for (i = 0; fn[i] != '\0'; i++)
if (!isprint(fn[i]) || fn[i] == ';')
return;
// Add file on your client directly if you aren't in a netgame.
if (!(netgame || multiplayer))
{
P_AddFolder(fn);
addedfolders[numfoldersadded++] = fn;
continue;
}
p = fn+strlen(fn);
while(--p >= fn)
if (*p == '\\' || *p == '/' || *p == ':')
break;
++p;
// Don't add an empty path.
if (M_IsStringEmpty(fn))
{
CONS_Alert(CONS_WARNING, M_GetText("Folder name is empty, skipping\n"));
continue;
}
// check no of files currently loaded
// See W_LoadWadFile in w_wad.c
if (numwadfiles >= MAX_WADFILES)
{
CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn);
return;
}
// Check if the path is valid.
stat = W_IsPathToFolderValid(fn);
if (stat == 0)
{
CONS_Alert(CONS_WARNING, M_GetText("Path %s is invalid, skipping\n"), fn);
continue;
}
else if (stat < 0)
{
#ifndef AVOID_ERRNO
CONS_Alert(CONS_WARNING, M_GetText("Error accessing %s (%s), skipping\n"), fn, strerror(direrror));
#else
CONS_Alert(CONS_WARNING, M_GetText("Error accessing %s, skipping\n"), fn);
#endif
continue;
}
// Get the full path for this folder.
fullpath = W_GetFullFolderPath(fn);
if (fullpath == NULL)
{
CONS_Alert(CONS_WARNING, M_GetText("Path %s is invalid, skipping\n"), fn);
continue;
}
// Check if the folder is already added.
for (i = 0; i < numwadfiles; i++)
{
if (wadfiles[i]->type != RET_FOLDER)
continue;
if (samepaths(wadfiles[i]->path, fullpath) > 0)
{
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
continue;
}
}
Z_Free(fullpath);
addedfolders[numfoldersadded++] = fn;
WRITESTRINGN(buf_p,p,240);
if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file
SendNetXCmd(XD_REQADDFOLDER, buf, buf_p - buf);
else
SendNetXCmd(XD_ADDFOLDER, buf, buf_p - buf);
}
}
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
{ {
char filename[241]; char filename[241];
filestatus_t ncs = FS_NOTFOUND; filestatus_t ncs = FS_NOTCHECKED;
UINT8 md5sum[16]; UINT8 md5sum[16];
boolean kick = false; boolean kick = false;
boolean toomany = false; boolean toomany = false;
@ -3400,9 +3570,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
return; return;
} }
// See W_LoadWadFile in w_wad.c if (numwadfiles >= MAX_WADFILES)
if ((numwadfiles >= MAX_WADFILES)
|| ((packetsizetally + nameonlylength(filename) + 22) > MAXFILENEEDED*sizeof(UINT8)))
toomany = true; toomany = true;
else else
ncs = findfile(filename,md5sum,true); ncs = findfile(filename,md5sum,true);
@ -3432,10 +3600,66 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
COM_BufAddText(va("addfile %s\n", filename)); COM_BufAddText(va("addfile %s\n", filename));
} }
static void Got_RequestAddfoldercmd(UINT8 **cp, INT32 playernum)
{
char path[241];
filestatus_t ncs = FS_NOTCHECKED;
boolean kick = false;
boolean toomany = false;
INT32 i,j;
READSTRINGN(*cp, path, 240);
/// \todo Integrity checks.
// Only the server processes this message.
if (client)
return;
// Disallow non-printing characters and semicolons.
for (i = 0; path[i] != '\0'; i++)
if (!isprint(path[i]) || path[i] == ';')
kick = true;
if ((playernum != serverplayer && !IsPlayerAdmin(playernum)) || kick)
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfolder command received from %s\n"), player_names[playernum]);
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
return;
}
if (numwadfiles >= MAX_WADFILES)
toomany = true;
else
ncs = findfolder(path);
if (ncs != FS_FOUND || toomany)
{
char message[256];
if (toomany)
sprintf(message, M_GetText("Too many files loaded to add %s\n"), path);
else if (ncs == FS_NOTFOUND)
sprintf(message, M_GetText("The server doesn't have %s\n"), path);
else
sprintf(message, M_GetText("Unknown error finding folder (%s)\n"), path);
CONS_Printf("%s",message);
for (j = 0; j < MAXPLAYERS; j++)
if (adminplayers[j])
COM_BufAddText(va("sayto %d %s", adminplayers[j], message));
return;
}
COM_BufAddText(va("addfolder \"%s\"\n", path));
}
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum) static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
{ {
char filename[241]; char filename[241];
filestatus_t ncs = FS_NOTFOUND; filestatus_t ncs = FS_NOTCHECKED;
UINT8 md5sum[16]; UINT8 md5sum[16];
READSTRINGN(*cp, filename, 240); READSTRINGN(*cp, filename, 240);
@ -3480,11 +3704,60 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
G_SetGameModified(true); G_SetGameModified(true);
} }
static void Got_Addfoldercmd(UINT8 **cp, INT32 playernum)
{
char path[241];
filestatus_t ncs = FS_NOTCHECKED;
READSTRINGN(*cp, path, 240);
/// \todo Integrity checks.
if (playernum != serverplayer)
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfolder command received from %s\n"), player_names[playernum]);
if (server)
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
return;
}
ncs = findfolder(path);
if (ncs != FS_FOUND || !P_AddFolder(path))
{
Command_ExitGame_f();
if (ncs == FS_FOUND)
{
CONS_Printf(M_GetText("The server tried to add %s,\nbut you have too many files added.\nRestart the game to clear loaded files\nand play on this server."), path);
M_StartMessage(va("The server added a folder \n(%s)\nbut you have too many files added.\nRestart the game to clear loaded files.\n\nPress ESC\n",path), NULL, MM_NOTHING);
}
else if (ncs == FS_NOTFOUND)
{
CONS_Printf(M_GetText("The server tried to add %s,\nbut you don't have this file.\nYou need to find it in order\nto play on this server."), path);
M_StartMessage(va("The server added a folder \n(%s)\nthat you do not have.\n\nPress ESC\n",path), NULL, MM_NOTHING);
}
else
{
CONS_Printf(M_GetText("Unknown error finding folder (%s) the server added.\n"), path);
M_StartMessage(va("Unknown error trying to load a folder\nthat the server added \n(%s).\n\nPress ESC\n",path), NULL, MM_NOTHING);
}
return;
}
G_SetGameModified(true);
}
static void Command_ListWADS_f(void) static void Command_ListWADS_f(void)
{ {
INT32 i = numwadfiles; INT32 i = numwadfiles;
char *tempname; char *tempname;
CONS_Printf(M_GetText("There are %d wads loaded:\n"),numwadfiles);
#ifdef ENFORCE_WAD_LIMIT
CONS_Printf(M_GetText("There are %d/%d files loaded:\n"),numwadfiles,MAX_WADFILES);
#else
CONS_Printf(M_GetText("There are %d files loaded:\n"),numwadfiles);
#endif
for (i--; i >= 0; i--) for (i--; i >= 0; i--)
{ {
nameonly(tempname = va("%s", wadfiles[i]->filename)); nameonly(tempname = va("%s", wadfiles[i]->filename));
@ -3494,6 +3767,8 @@ static void Command_ListWADS_f(void)
CONS_Printf("\x82 * %.2d\x80: %s\n", i, tempname); CONS_Printf("\x82 * %.2d\x80: %s\n", i, tempname);
else if (!wadfiles[i]->important) else if (!wadfiles[i]->important)
CONS_Printf("\x86 %.2d: %s\n", i, tempname); CONS_Printf("\x86 %.2d: %s\n", i, tempname);
else if (wadfiles[i]->type == RET_FOLDER)
CONS_Printf("\x82 * %.2d\x84: %s\n", i, tempname);
else else
CONS_Printf(" %.2d: %s\n", i, tempname); CONS_Printf(" %.2d: %s\n", i, tempname);
} }
@ -3606,8 +3881,7 @@ static void Command_Playintro_f(void)
*/ */
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void) FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
{ {
if (Playing()) LUA_HookBool(true, HOOK(GameQuit));
LUAh_GameQuit();
I_Quit(); I_Quit();
} }
@ -4269,8 +4543,7 @@ void Command_ExitGame_f(void)
{ {
INT32 i; INT32 i;
if (Playing()) LUA_HookBool(false, HOOK(GameQuit));
LUAh_GameQuit();
D_QuitNetGame(); D_QuitNetGame();
CL_Reset(); CL_Reset();

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -31,9 +31,7 @@ extern consvar_t cv_defaultskin;
extern consvar_t cv_defaultplayercolor2; extern consvar_t cv_defaultplayercolor2;
extern consvar_t cv_defaultskin2; extern consvar_t cv_defaultskin2;
#ifdef SEENAMES
extern consvar_t cv_seenames, cv_allowseenames; extern consvar_t cv_seenames, cv_allowseenames;
#endif
extern consvar_t cv_usemouse; extern consvar_t cv_usemouse;
extern consvar_t cv_usejoystick; extern consvar_t cv_usejoystick;
extern consvar_t cv_usejoystick2; extern consvar_t cv_usejoystick2;
@ -47,7 +45,7 @@ extern consvar_t cv_joyscale2;
// splitscreen with second mouse // splitscreen with second mouse
extern consvar_t cv_mouse2port; extern consvar_t cv_mouse2port;
extern consvar_t cv_usemouse2; extern consvar_t cv_usemouse2;
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
extern consvar_t cv_mouse2opt; extern consvar_t cv_mouse2opt;
#endif #endif
@ -75,6 +73,7 @@ extern consvar_t cv_teamscramble;
extern consvar_t cv_scrambleonchange; extern consvar_t cv_scrambleonchange;
extern consvar_t cv_netstat; extern consvar_t cv_netstat;
extern consvar_t cv_nettimeout;
extern consvar_t cv_countdowntime; extern consvar_t cv_countdowntime;
extern consvar_t cv_runscripts; extern consvar_t cv_runscripts;
@ -112,6 +111,8 @@ extern consvar_t cv_skipmapcheck;
extern consvar_t cv_sleep; extern consvar_t cv_sleep;
extern consvar_t cv_perfstats; extern consvar_t cv_perfstats;
extern consvar_t cv_ps_samplesize;
extern consvar_t cv_ps_descriptor;
extern char timedemo_name[256]; extern char timedemo_name[256];
extern boolean timedemo_csv; extern boolean timedemo_csv;
@ -130,16 +131,16 @@ typedef enum
XD_MAP, // 6 XD_MAP, // 6
XD_EXITLEVEL, // 7 XD_EXITLEVEL, // 7
XD_ADDFILE, // 8 XD_ADDFILE, // 8
XD_PAUSE, // 9 XD_ADDFOLDER, // 9
XD_ADDPLAYER, // 10 XD_PAUSE, // 10
XD_TEAMCHANGE, // 11 XD_ADDPLAYER, // 11
XD_CLEARSCORES, // 12 XD_TEAMCHANGE, // 12
// UNUSED 13 (Because I don't want to change these comments) XD_CLEARSCORES, // 13
XD_VERIFIED = 14,//14 XD_VERIFIED, // 14
XD_RANDOMSEED, // 15 XD_RANDOMSEED, // 15
XD_RUNSOC, // 16 XD_RUNSOC, // 16
XD_REQADDFILE, // 17 XD_REQADDFILE, // 17
XD_DELFILE, // 18 - replace next time we add an XD XD_REQADDFOLDER,// 18
XD_SETMOTD, // 19 XD_SETMOTD, // 19
XD_SUICIDE, // 20 XD_SUICIDE, // 20
XD_DEMOTED, // 21 XD_DEMOTED, // 21

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -15,7 +15,7 @@
#include <time.h> #include <time.h>
#if defined (_WIN32) || defined (__DJGPP__) #ifdef _WIN32
#include <io.h> #include <io.h>
#include <direct.h> #include <direct.h>
#else #else
@ -30,10 +30,6 @@
#elif defined (_WIN32) #elif defined (_WIN32)
#include <sys/utime.h> #include <sys/utime.h>
#endif #endif
#ifdef __DJGPP__
#include <dir.h>
#include <utime.h>
#endif
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
@ -56,7 +52,7 @@
#include <errno.h> #include <errno.h>
// Prototypes // Prototypes
static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid); static boolean AddFileToSendQueue(INT32 node, UINT8 fileid);
// Sender structure // Sender structure
typedef struct filetx_s typedef struct filetx_s
@ -91,7 +87,7 @@ static filetran_t transfer[MAXNETNODES];
// Receiver structure // Receiver structure
INT32 fileneedednum; // Number of files needed to join the server INT32 fileneedednum; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files fileneeded_t *fileneeded; // List of needed files
static tic_t lasttimeackpacketsent = 0; static tic_t lasttimeackpacketsent = 0;
char downloaddir[512] = "DOWNLOAD"; char downloaddir[512] = "DOWNLOAD";
@ -109,6 +105,10 @@ static pauseddownload_t *pauseddownload = NULL;
#ifndef NONET #ifndef NONET
// for cl loading screen // for cl loading screen
INT32 lastfilenum = -1; INT32 lastfilenum = -1;
INT32 downloadcompletednum = 0;
UINT32 downloadcompletedsize = 0;
INT32 totalfilesrequestednum = 0;
UINT32 totalfilesrequestedsize = 0;
#endif #endif
luafiletransfer_t *luafiletransfers = NULL; luafiletransfer_t *luafiletransfers = NULL;
@ -117,29 +117,67 @@ boolean waitingforluafilecommand = false;
char luafiledir[256 + 16] = "luafiles"; char luafiledir[256 + 16] = "luafiles";
static UINT16 GetWadNumFromFileNeededId(UINT8 id)
{
UINT16 wadnum;
for (wadnum = mainwads; wadnum < numwadfiles; wadnum++)
{
if (!wadfiles[wadnum]->important)
continue;
if (id == 0)
return wadnum;
id--;
}
return UINT16_MAX;
}
/** Fills a serverinfo packet with information about wad files loaded. /** Fills a serverinfo packet with information about wad files loaded.
* *
* \todo Give this function a better name since it is in global scope. * \todo Give this function a better name since it is in global scope.
* Used to have size limiting built in - now handled via W_LoadWadFile in w_wad.c * Used to have size limiting built in - now handled via W_InitFile in w_wad.c
* *
*/ */
UINT8 *PutFileNeeded(void) UINT8 *PutFileNeeded(UINT16 firstfile)
{ {
size_t i, count = 0; size_t i;
UINT8 *p = netbuffer->u.serverinfo.fileneeded; UINT8 count = 0;
UINT8 *p_start = netbuffer->packettype == PT_MOREFILESNEEDED ? netbuffer->u.filesneededcfg.files : netbuffer->u.serverinfo.fileneeded;
UINT8 *p = p_start;
char wadfilename[MAX_WADPATH] = ""; char wadfilename[MAX_WADPATH] = "";
UINT8 filestatus; UINT8 filestatus, folder;
for (i = 0; i < numwadfiles; i++) for (i = mainwads; i < numwadfiles; i++) //mainwads, otherwise we start on the first mainwad
{ {
// If it has only music/sound lumps, don't put it in the list // If it has only music/sound lumps, don't put it in the list
if (!wadfiles[i]->important) if (!wadfiles[i]->important)
continue; continue;
if (firstfile)
{ // Skip files until we reach the first file.
firstfile--;
continue;
}
nameonly(strcpy(wadfilename, wadfiles[i]->filename));
// Look below at the WRITE macros to understand what these numbers mean.
if (p + 1 + 4 + min(strlen(wadfilename) + 1, MAX_WADPATH) + 16 > p_start + MAXFILENEEDED)
{
// Too many files to send all at once
if (netbuffer->packettype == PT_MOREFILESNEEDED)
netbuffer->u.filesneededcfg.more = 1;
else
netbuffer->u.serverinfo.flags |= SV_LOTSOFADDONS;
break;
}
filestatus = 1; // Importance - not really used any more, holds 1 by default for backwards compat with MS filestatus = 1; // Importance - not really used any more, holds 1 by default for backwards compat with MS
folder = (wadfiles[i]->type == RET_FOLDER);
// Store in the upper four bits // Store in the upper four bits
if (!cv_downloading.value) if (!cv_downloading.value || folder) /// \todo Implement folder downloading.
filestatus += (2 << 4); // Won't send filestatus += (2 << 4); // Won't send
else if ((wadfiles[i]->filesize <= (UINT32)cv_maxsend.value * 1024)) else if ((wadfiles[i]->filesize <= (UINT32)cv_maxsend.value * 1024))
filestatus += (1 << 4); // Will send if requested filestatus += (1 << 4); // Will send if requested
@ -147,37 +185,60 @@ UINT8 *PutFileNeeded(void)
// filestatus += (0 << 4); -- Won't send, too big // filestatus += (0 << 4); -- Won't send, too big
WRITEUINT8(p, filestatus); WRITEUINT8(p, filestatus);
WRITEUINT8(p, folder);
count++; count++;
WRITEUINT32(p, wadfiles[i]->filesize); WRITEUINT32(p, wadfiles[i]->filesize);
nameonly(strcpy(wadfilename, wadfiles[i]->filename));
WRITESTRINGN(p, wadfilename, MAX_WADPATH); WRITESTRINGN(p, wadfilename, MAX_WADPATH);
WRITEMEM(p, wadfiles[i]->md5sum, 16); WRITEMEM(p, wadfiles[i]->md5sum, 16);
} }
netbuffer->u.serverinfo.fileneedednum = (UINT8)count;
if (netbuffer->packettype == PT_MOREFILESNEEDED)
netbuffer->u.filesneededcfg.num = count;
else
netbuffer->u.serverinfo.fileneedednum = count;
return p; return p;
} }
void AllocFileNeeded(INT32 size)
{
if (fileneeded == NULL)
fileneeded = Z_Calloc(sizeof(fileneeded_t) * size, PU_STATIC, NULL);
else
fileneeded = Z_Realloc(fileneeded, sizeof(fileneeded_t) * size, PU_STATIC, NULL);
}
void FreeFileNeeded(void)
{
Z_Free(fileneeded);
fileneeded = NULL;
}
/** Parses the serverinfo packet and fills the fileneeded table on client /** Parses the serverinfo packet and fills the fileneeded table on client
* *
* \param fileneedednum_parm The number of files needed to join the server * \param fileneedednum_parm The number of files needed to join the server
* \param fileneededstr The memory block containing the list of needed files * \param fileneededstr The memory block containing the list of needed files
* *
*/ */
void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr) void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 firstfile)
{ {
INT32 i; INT32 i;
UINT8 *p; UINT8 *p;
UINT8 filestatus; UINT8 filestatus;
fileneedednum = fileneedednum_parm; fileneedednum = firstfile + fileneedednum_parm;
p = (UINT8 *)fileneededstr; p = (UINT8 *)fileneededstr;
for (i = 0; i < fileneedednum; i++)
AllocFileNeeded(fileneedednum);
for (i = firstfile; i < fileneedednum; i++)
{ {
fileneeded[i].status = FS_NOTFOUND; // We haven't even started looking for the file yet fileneeded[i].type = FILENEEDED_WAD;
fileneeded[i].status = FS_NOTCHECKED; // We haven't even started looking for the file yet
fileneeded[i].justdownloaded = false; fileneeded[i].justdownloaded = false;
filestatus = READUINT8(p); // The first byte is the file status filestatus = READUINT8(p); // The first byte is the file status
fileneeded[i].folder = READUINT8(p); // The second byte is the folder flag
fileneeded[i].willsend = (UINT8)(filestatus >> 4); fileneeded[i].willsend = (UINT8)(filestatus >> 4);
fileneeded[i].totalsize = READUINT32(p); // The four next bytes are the file size fileneeded[i].totalsize = READUINT32(p); // The four next bytes are the file size
fileneeded[i].file = NULL; // The file isn't open yet fileneeded[i].file = NULL; // The file isn't open yet
@ -192,7 +253,11 @@ void CL_PrepareDownloadSaveGame(const char *tmpsave)
lastfilenum = -1; lastfilenum = -1;
#endif #endif
FreeFileNeeded();
AllocFileNeeded(1);
fileneedednum = 1; fileneedednum = 1;
fileneeded[0].type = FILENEEDED_SAVEGAME;
fileneeded[0].status = FS_REQUESTED; fileneeded[0].status = FS_REQUESTED;
fileneeded[0].justdownloaded = false; fileneeded[0].justdownloaded = false;
fileneeded[0].totalsize = UINT32_MAX; fileneeded[0].totalsize = UINT32_MAX;
@ -323,14 +388,18 @@ boolean CL_SendFileRequest(void)
if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)) if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD))
{ {
totalfreespaceneeded += fileneeded[i].totalsize; totalfreespaceneeded += fileneeded[i].totalsize;
nameonly(fileneeded[i].filename);
WRITEUINT8(p, i); // fileid WRITEUINT8(p, i); // fileid
WRITESTRINGN(p, fileneeded[i].filename, MAX_WADPATH);
// put it in download dir // put it in download dir
nameonly(fileneeded[i].filename);
strcatbf(fileneeded[i].filename, downloaddir, "/"); strcatbf(fileneeded[i].filename, downloaddir, "/");
fileneeded[i].status = FS_REQUESTED; fileneeded[i].status = FS_REQUESTED;
} }
WRITEUINT8(p, 0xFF); WRITEUINT8(p, 0xFF);
I_GetDiskFreeSpace(&availablefreespace); I_GetDiskFreeSpace(&availablefreespace);
if (totalfreespaceneeded > availablefreespace) if (totalfreespaceneeded > availablefreespace)
I_Error("To play on this server you must download %s KB,\n" I_Error("To play on this server you must download %s KB,\n"
@ -346,21 +415,22 @@ boolean CL_SendFileRequest(void)
// returns false if a requested file was not found or cannot be sent // returns false if a requested file was not found or cannot be sent
boolean PT_RequestFile(INT32 node) boolean PT_RequestFile(INT32 node)
{ {
char wad[MAX_WADPATH+1];
UINT8 *p = netbuffer->u.textcmd; UINT8 *p = netbuffer->u.textcmd;
UINT8 id; UINT8 id;
while (p < netbuffer->u.textcmd + MAXTEXTCMD-1) // Don't allow hacked client to overflow while (p < netbuffer->u.textcmd + MAXTEXTCMD-1) // Don't allow hacked client to overflow
{ {
id = READUINT8(p); id = READUINT8(p);
if (id == 0xFF) if (id == 0xFF)
break; break;
READSTRINGN(p, wad, MAX_WADPATH);
if (!AddFileToSendQueue(node, wad, id)) if (!AddFileToSendQueue(node, id))
{ {
SV_AbortSendFiles(node); SV_AbortSendFiles(node);
return false; // don't read the rest of the files return false; // don't read the rest of the files
} }
} }
return true; // no problems with any files return true; // no problems with any files
} }
@ -369,23 +439,16 @@ boolean PT_RequestFile(INT32 node)
* \return 0 if some files are missing * \return 0 if some files are missing
* 1 if all files exist * 1 if all files exist
* 2 if some already loaded files are not requested or are in a different order * 2 if some already loaded files are not requested or are in a different order
* 3 too many files, over WADLIMIT
* 4 still checking, continuing next tic
* *
*/ */
INT32 CL_CheckFiles(void) INT32 CL_CheckFiles(void)
{ {
INT32 i, j; INT32 i, j;
char wadfilename[MAX_WADPATH]; char wadfilename[MAX_WADPATH];
INT32 ret = 1; size_t filestoload = 0;
size_t packetsize = 0; boolean downloadrequired = false;
size_t filestoget = 0;
// if (M_CheckParm("-nofiles"))
// return 1;
// the first is the iwad (the main wad file)
// we don't care if it's called srb2.pk3 or not.
// Never download the IWAD, just assume it's there and identical
fileneeded[0].status = FS_OPEN;
// Modified game handling -- check for an identical file list // Modified game handling -- check for an identical file list
// must be identical in files loaded AND in order // must be identical in files loaded AND in order
@ -393,7 +456,7 @@ INT32 CL_CheckFiles(void)
if (modifiedgame) if (modifiedgame)
{ {
CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n"); CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n");
for (i = 1, j = 1; i < fileneedednum || j < numwadfiles;) for (i = 0, j = mainwads; i < fileneedednum || j < numwadfiles;)
{ {
if (j < numwadfiles && !wadfiles[j]->important) if (j < numwadfiles && !wadfiles[j]->important)
{ {
@ -420,15 +483,21 @@ INT32 CL_CheckFiles(void)
return 1; return 1;
} }
// See W_LoadWadFile in w_wad.c for (i = 0; i < fileneedednum; i++)
packetsize = packetsizetally;
for (i = 1; i < fileneedednum; i++)
{ {
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
downloadrequired = true;
if (fileneeded[i].status != FS_OPEN)
filestoload++;
if (fileneeded[i].status != FS_NOTCHECKED) //since we're running this over multiple tics now, its possible for us to come across files checked in previous tics
continue;
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename); CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
// Check in already loaded files // Check in already loaded files
for (j = 1; wadfiles[j]; j++) for (j = mainwads; wadfiles[j]; j++)
{ {
nameonly(strcpy(wadfilename, wadfiles[j]->filename)); nameonly(strcpy(wadfilename, wadfiles[j]->filename));
if (!stricmp(wadfilename, fileneeded[i].filename) && if (!stricmp(wadfilename, fileneeded[i].filename) &&
@ -436,45 +505,46 @@ INT32 CL_CheckFiles(void)
{ {
CONS_Debug(DBG_NETPLAY, "already loaded\n"); CONS_Debug(DBG_NETPLAY, "already loaded\n");
fileneeded[i].status = FS_OPEN; fileneeded[i].status = FS_OPEN;
break; return 4;
} }
} }
if (fileneeded[i].status != FS_NOTFOUND)
continue;
packetsize += nameonlylength(fileneeded[i].filename) + 22; if (fileneeded[i].folder)
fileneeded[i].status = findfolder(fileneeded[i].filename);
else
fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true);
if ((numwadfiles+filestoget >= MAX_WADFILES)
|| (packetsize > MAXFILENEEDED*sizeof(UINT8)))
return 3;
filestoget++;
fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true);
CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status); CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status);
if (fileneeded[i].status != FS_FOUND) return 4;
ret = 0;
} }
return ret;
//now making it here means we've checked the entire list and no FS_NOTCHECKED files remain
if (numwadfiles+filestoload > MAX_WADFILES)
return 3;
else if (downloadrequired)
return 0; //some stuff is FS_NOTFOUND, needs download
else
return 1; //everything is FS_OPEN or FS_FOUND, proceed to loading
} }
// Load it now // Load it now
void CL_LoadServerFiles(void) boolean CL_LoadServerFiles(void)
{ {
INT32 i; INT32 i;
// if (M_CheckParm("-nofiles")) for (i = 0; i < fileneedednum; i++)
// return;
for (i = 1; i < fileneedednum; i++)
{ {
if (fileneeded[i].status == FS_OPEN) if (fileneeded[i].status == FS_OPEN)
continue; // Already loaded continue; // Already loaded
else if (fileneeded[i].status == FS_FOUND) else if (fileneeded[i].status == FS_FOUND)
{ {
P_AddWadFile(fileneeded[i].filename); if (fileneeded[i].folder)
P_AddFolder(fileneeded[i].filename);
else
P_AddWadFile(fileneeded[i].filename);
G_SetGameModified(true); G_SetGameModified(true);
fileneeded[i].status = FS_OPEN; fileneeded[i].status = FS_OPEN;
return false;
} }
else if (fileneeded[i].status == FS_MD5SUMBAD) else if (fileneeded[i].status == FS_MD5SUMBAD)
I_Error("Wrong version of file %s", fileneeded[i].filename); I_Error("Wrong version of file %s", fileneeded[i].filename);
@ -500,6 +570,7 @@ void CL_LoadServerFiles(void)
fileneeded[i].status, s); fileneeded[i].status, s);
} }
} }
return true;
} }
void AddLuaFileTransfer(const char *filename, const char *mode) void AddLuaFileTransfer(const char *filename, const char *mode)
@ -562,7 +633,7 @@ static void SV_PrepareSendLuaFileToNextNode(void)
// Find a client to send the file to // Find a client to send the file to
for (i = 1; i < MAXNETNODES; i++) for (i = 1; i < MAXNETNODES; i++)
if (nodeingame[i] && luafiletransfers->nodestatus[i] == LFTNS_WAITING) // Node waiting if (luafiletransfers->nodestatus[i] == LFTNS_WAITING) // Node waiting
{ {
// Tell the client we're about to send them the file // Tell the client we're about to send them the file
netbuffer->packettype = PT_SENDINGLUAFILE; netbuffer->packettype = PT_SENDINGLUAFILE;
@ -570,6 +641,7 @@ static void SV_PrepareSendLuaFileToNextNode(void)
I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol
luafiletransfers->nodestatus[i] = LFTNS_ASKED; luafiletransfers->nodestatus[i] = LFTNS_ASKED;
luafiletransfers->nodetimeouts[i] = I_GetTime() + 30 * TICRATE;
return; return;
} }
@ -588,7 +660,7 @@ void SV_PrepareSendLuaFile(void)
// Set status to "waiting" for everyone // Set status to "waiting" for everyone
for (i = 0; i < MAXNETNODES; i++) for (i = 0; i < MAXNETNODES; i++)
luafiletransfers->nodestatus[i] = LFTNS_WAITING; luafiletransfers->nodestatus[i] = (nodeingame[i] ? LFTNS_WAITING : LFTNS_NONE);
if (FIL_ReadFileOK(luafiletransfers->realfilename)) if (FIL_ReadFileOK(luafiletransfers->realfilename))
{ {
@ -649,12 +721,14 @@ void RemoveAllLuaFileTransfers(void)
void SV_AbortLuaFileTransfer(INT32 node) void SV_AbortLuaFileTransfer(INT32 node)
{ {
if (luafiletransfers if (luafiletransfers)
&& (luafiletransfers->nodestatus[node] == LFTNS_ASKED
|| luafiletransfers->nodestatus[node] == LFTNS_SENDING))
{ {
luafiletransfers->nodestatus[node] = LFTNS_WAITING; if (luafiletransfers->nodestatus[node] == LFTNS_ASKED
SV_PrepareSendLuaFileToNextNode(); || luafiletransfers->nodestatus[node] == LFTNS_SENDING)
{
SV_PrepareSendLuaFileToNextNode();
}
luafiletransfers->nodestatus[node] = LFTNS_NONE;
} }
} }
@ -678,7 +752,11 @@ void CL_PrepareDownloadLuaFile(void)
netbuffer->packettype = PT_ASKLUAFILE; netbuffer->packettype = PT_ASKLUAFILE;
HSendPacket(servernode, true, 0, 0); HSendPacket(servernode, true, 0, 0);
FreeFileNeeded();
AllocFileNeeded(1);
fileneedednum = 1; fileneedednum = 1;
fileneeded[0].type = FILENEEDED_LUAFILE;
fileneeded[0].status = FS_REQUESTED; fileneeded[0].status = FS_REQUESTED;
fileneeded[0].justdownloaded = false; fileneeded[0].justdownloaded = false;
fileneeded[0].totalsize = UINT32_MAX; fileneeded[0].totalsize = UINT32_MAX;
@ -705,15 +783,11 @@ static INT32 filestosend = 0;
* \sa AddLuaFileToSendQueue * \sa AddLuaFileToSendQueue
* *
*/ */
static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid) static boolean AddFileToSendQueue(INT32 node, UINT8 fileid)
{ {
filetx_t **q; // A pointer to the "next" field of the last file in the list filetx_t **q; // A pointer to the "next" field of the last file in the list
filetx_t *p; // The new file request filetx_t *p; // The new file request
INT32 i; UINT16 wadnum;
char wadfilename[MAX_WADPATH];
if (cv_noticedownload.value)
CONS_Printf("Sending file \"%s\" to node %d (%s)\n", filename, node, I_GetNodeAddress(node));
// Find the last file in the list and set a pointer to its "next" field // Find the last file in the list and set a pointer to its "next" field
q = &transfer[node].txlist; q = &transfer[node].txlist;
@ -733,51 +807,43 @@ static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid
if (!p->id.filename) if (!p->id.filename)
I_Error("AddFileToSendQueue: No more memory\n"); I_Error("AddFileToSendQueue: No more memory\n");
// Set the file name and get rid of the path // Find the wad the ID refers to
strlcpy(p->id.filename, filename, MAX_WADPATH); wadnum = GetWadNumFromFileNeededId(fileid);
nameonly(p->id.filename);
// Look for the requested file through all loaded files
for (i = 0; wadfiles[i]; i++)
{
strlcpy(wadfilename, wadfiles[i]->filename, MAX_WADPATH);
nameonly(wadfilename);
if (!stricmp(wadfilename, p->id.filename))
{
// Copy file name with full path
strlcpy(p->id.filename, wadfiles[i]->filename, MAX_WADPATH);
break;
}
}
// Handle non-loaded file requests // Handle non-loaded file requests
if (!wadfiles[i]) if (wadnum == UINT16_MAX)
{ {
DEBFILE(va("%s not found in wadfiles\n", filename)); DEBFILE(va("fileneeded %d not found in wadfiles\n", fileid));
// This formerly checked if (!findfile(p->id.filename, NULL, true)) // This formerly checked if (!findfile(p->id.filename, NULL, true))
// Not found // Not found
// Don't inform client (probably someone who thought they could leak 2.2 ACZ) // Don't inform client
DEBFILE(va("Client %d request %s: not found\n", node, filename)); DEBFILE(va("Client %d request fileneeded %d: not found\n", node, fileid));
free(p->id.filename); free(p->id.filename);
free(p); free(p);
*q = NULL; *q = NULL;
return false; // cancel the rest of the requests return false; // cancel the rest of the requests
} }
// Set the file name and get rid of the path
strlcpy(p->id.filename, wadfiles[wadnum]->filename, MAX_WADPATH);
// Handle huge file requests (i.e. bigger than cv_maxsend.value KB) // Handle huge file requests (i.e. bigger than cv_maxsend.value KB)
if (wadfiles[i]->filesize > (UINT32)cv_maxsend.value * 1024) if (wadfiles[wadnum]->filesize > (UINT32)cv_maxsend.value * 1024)
{ {
// Too big // Too big
// Don't inform client (client sucks, man) // Don't inform client (client sucks, man)
DEBFILE(va("Client %d request %s: file too big, not sending\n", node, filename)); DEBFILE(va("Client %d request %s: file too big, not sending\n", node, p->id.filename));
free(p->id.filename); free(p->id.filename);
free(p); free(p);
*q = NULL; *q = NULL;
return false; // cancel the rest of the requests return false; // cancel the rest of the requests
} }
DEBFILE(va("Sending file %s (id=%d) to %d\n", filename, fileid, node)); if (cv_noticedownload.value)
CONS_Printf("Sending file \"%s\" to node %d (%s)\n", p->id.filename, node, I_GetNodeAddress(node));
DEBFILE(va("Sending file %s (id=%d) to %d\n", p->id.filename, fileid, node));
p->ram = SF_FILE; // It's a file, we need to close it and free its name once we're done sending it p->ram = SF_FILE; // It's a file, we need to close it and free its name once we're done sending it
p->fileid = fileid; p->fileid = fileid;
p->next = NULL; // End of list p->next = NULL; // End of list
@ -914,7 +980,6 @@ static void SV_EndFileSend(INT32 node)
filestosend--; filestosend--;
} }
#define PACKETPERTIC net_bandwidth/(TICRATE*software_MAXPACKETLENGTH)
#define FILEFRAGMENTSIZE (software_MAXPACKETLENGTH - (FILETXHEADER + BASEPACKETSIZE)) #define FILEFRAGMENTSIZE (software_MAXPACKETLENGTH - (FILETXHEADER + BASEPACKETSIZE))
/** Handles file transmission /** Handles file transmission
@ -928,17 +993,26 @@ void FileSendTicker(void)
filetx_t *f; filetx_t *f;
INT32 packetsent, ram, i, j; INT32 packetsent, ram, i, j;
// If someone is taking too long to download, kick them with a timeout
// to prevent blocking the rest of the server...
if (luafiletransfers)
{
for (i = 1; i < MAXNETNODES; i++)
{
luafiletransfernodestatus_t status = luafiletransfers->nodestatus[i];
if (status != LFTNS_NONE && status != LFTNS_WAITING && status != LFTNS_SENT
&& I_GetTime() > luafiletransfers->nodetimeouts[i])
{
Net_ConnectionTimeout(i);
}
}
}
if (!filestosend) // No file to send if (!filestosend) // No file to send
return; return;
if (cv_downloadspeed.value) // New behavior packetsent = cv_downloadspeed.value;
packetsent = cv_downloadspeed.value;
else // Old behavior
{
packetsent = PACKETPERTIC;
if (!packetsent)
packetsent = 1;
}
netbuffer->packettype = PT_FILEFRAGMENT; netbuffer->packettype = PT_FILEFRAGMENT;
@ -1215,6 +1289,9 @@ void PT_FileFragment(void)
UINT16 boundedfragmentsize = doomcom->datalength - BASEPACKETSIZE - sizeof(netbuffer->u.filetxpak); UINT16 boundedfragmentsize = doomcom->datalength - BASEPACKETSIZE - sizeof(netbuffer->u.filetxpak);
char *filename; char *filename;
if (!file)
return;
filename = va("%s", file->filename); filename = va("%s", file->filename);
nameonly(filename); nameonly(filename);
@ -1326,6 +1403,7 @@ void PT_FileFragment(void)
// Tell the server we have received the file // Tell the server we have received the file
netbuffer->packettype = PT_HASLUAFILE; netbuffer->packettype = PT_HASLUAFILE;
HSendPacket(servernode, true, 0, 0); HSendPacket(servernode, true, 0, 0);
FreeFileNeeded();
} }
} }
} }
@ -1396,32 +1474,37 @@ void CloseNetFile(void)
SV_AbortSendFiles(i); SV_AbortSendFiles(i);
// Receiving a file? // Receiving a file?
for (i = 0; i < MAX_WADFILES; i++) if (fileneeded)
if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file) {
{ for (i = 0; i < fileneedednum; i++)
fclose(fileneeded[i].file); if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file)
free(fileneeded[i].ackpacket);
if (!pauseddownload && i != 0) // 0 is either srb2.srb or the gamestate...
{ {
// Don't remove the file, save it for later in case we resume the download fclose(fileneeded[i].file);
pauseddownload = malloc(sizeof(*pauseddownload)); free(fileneeded[i].ackpacket);
if (!pauseddownload)
I_Error("CloseNetFile: No more memory\n");
strcpy(pauseddownload->filename, fileneeded[i].filename); if (!pauseddownload && (fileneeded[i].type == FILENEEDED_WAD || i != 0)) // 0 is the gamestate...
memcpy(pauseddownload->md5sum, fileneeded[i].md5sum, 16); {
pauseddownload->currentsize = fileneeded[i].currentsize; // Don't remove the file, save it for later in case we resume the download
pauseddownload->receivedfragments = fileneeded[i].receivedfragments; pauseddownload = malloc(sizeof(*pauseddownload));
pauseddownload->fragmentsize = fileneeded[i].fragmentsize; if (!pauseddownload)
I_Error("CloseNetFile: No more memory\n");
strcpy(pauseddownload->filename, fileneeded[i].filename);
memcpy(pauseddownload->md5sum, fileneeded[i].md5sum, 16);
pauseddownload->currentsize = fileneeded[i].currentsize;
pauseddownload->receivedfragments = fileneeded[i].receivedfragments;
pauseddownload->fragmentsize = fileneeded[i].fragmentsize;
}
else
{
// File is not complete, delete it.
free(fileneeded[i].receivedfragments);
remove(fileneeded[i].filename);
}
} }
else }
{
free(fileneeded[i].receivedfragments); FreeFileNeeded();
// File is not complete delete it
remove(fileneeded[i].filename);
}
}
} }
void Command_Downloads_f(void) void Command_Downloads_f(void)
@ -1556,3 +1639,26 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
return (badmd5 ? FS_MD5SUMBAD : FS_NOTFOUND); // md5 sum bad or file not found return (badmd5 ? FS_MD5SUMBAD : FS_NOTFOUND); // md5 sum bad or file not found
} }
// Searches for a folder.
// This can be used with a full path, or an incomplete path.
// In the latter case, the function will try to find folders in
// srb2home, srb2path, and the current directory.
filestatus_t findfolder(const char *path)
{
// Check the path by itself first.
if (concatpaths(path, NULL) == 1)
return FS_FOUND;
#define checkpath(startpath) \
if (concatpaths(path, startpath) == 1) \
return FS_FOUND
checkpath(srb2home); // Then, look in srb2home.
checkpath(srb2path); // Now, look in srb2path.
checkpath("."); // Finally, look in the current directory.
#undef checkpath
return FS_NOTFOUND;
}

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -27,6 +27,7 @@ typedef enum
typedef enum typedef enum
{ {
FS_NOTCHECKED,
FS_NOTFOUND, FS_NOTFOUND,
FS_FOUND, FS_FOUND,
FS_REQUESTED, FS_REQUESTED,
@ -35,12 +36,21 @@ typedef enum
FS_MD5SUMBAD FS_MD5SUMBAD
} filestatus_t; } filestatus_t;
typedef enum
{
FILENEEDED_WAD,
FILENEEDED_SAVEGAME,
FILENEEDED_LUAFILE
} fileneededtype_t;
typedef struct typedef struct
{ {
UINT8 willsend; // Is the server willing to send it?
char filename[MAX_WADPATH]; char filename[MAX_WADPATH];
UINT8 md5sum[16]; UINT8 md5sum[16];
filestatus_t status; // The value returned by recsearch filestatus_t status; // The value returned by recsearch
UINT8 willsend; // Is the server willing to send it?
UINT8 folder; // File is a folder
fileneededtype_t type;
boolean justdownloaded; // To prevent late fragments from causing an I_Error boolean justdownloaded; // To prevent late fragments from causing an I_Error
// Used only for download // Used only for download
@ -54,20 +64,28 @@ typedef struct
UINT32 ackresendposition; // Used when resuming downloads UINT32 ackresendposition; // Used when resuming downloads
} fileneeded_t; } fileneeded_t;
#define FILENEEDEDSIZE 23
extern INT32 fileneedednum; extern INT32 fileneedednum;
extern fileneeded_t fileneeded[MAX_WADFILES]; extern fileneeded_t *fileneeded;
extern char downloaddir[512]; extern char downloaddir[512];
#ifndef NONET #ifndef NONET
extern INT32 lastfilenum; extern INT32 lastfilenum;
extern INT32 downloadcompletednum;
extern UINT32 downloadcompletedsize;
extern INT32 totalfilesrequestednum;
extern UINT32 totalfilesrequestedsize;
#endif #endif
UINT8 *PutFileNeeded(void); void AllocFileNeeded(INT32 size);
void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr); void FreeFileNeeded(void);
UINT8 *PutFileNeeded(UINT16 firstfile);
void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 firstfile);
void CL_PrepareDownloadSaveGame(const char *tmpsave); void CL_PrepareDownloadSaveGame(const char *tmpsave);
INT32 CL_CheckFiles(void); INT32 CL_CheckFiles(void);
void CL_LoadServerFiles(void); boolean CL_LoadServerFiles(void);
void AddRamToSendQueue(INT32 node, void *data, size_t size, freemethod_t freemethod, void AddRamToSendQueue(INT32 node, void *data, size_t size, freemethod_t freemethod,
UINT8 fileid); UINT8 fileid);
@ -85,10 +103,11 @@ boolean PT_RequestFile(INT32 node);
typedef enum typedef enum
{ {
LFTNS_NONE, // This node is not connected
LFTNS_WAITING, // This node is waiting for the server to send the file LFTNS_WAITING, // This node is waiting for the server to send the file
LFTNS_ASKED, // The server has told the node they're ready to send the file LFTNS_ASKED, // The server has told the node they're ready to send the file
LFTNS_SENDING, // The server is sending the file to this node LFTNS_SENDING, // The server is sending the file to this node
LFTNS_SENT // The node already has the file LFTNS_SENT // The node already has the file
} luafiletransfernodestatus_t; } luafiletransfernodestatus_t;
typedef struct luafiletransfer_s typedef struct luafiletransfer_s
@ -99,6 +118,7 @@ typedef struct luafiletransfer_s
INT32 id; // Callback ID INT32 id; // Callback ID
boolean ongoing; boolean ongoing;
luafiletransfernodestatus_t nodestatus[MAXNETNODES]; luafiletransfernodestatus_t nodestatus[MAXNETNODES];
tic_t nodetimeouts[MAXNETNODES];
struct luafiletransfer_s *next; struct luafiletransfer_s *next;
} luafiletransfer_t; } luafiletransfer_t;
@ -133,6 +153,9 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum,
boolean completepath); boolean completepath);
filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum); filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum);
// Searches for a folder
filestatus_t findfolder(const char *path);
void nameonly(char *s); void nameonly(char *s);
size_t nameonlylength(const char *s); size_t nameonlylength(const char *s);

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -51,7 +51,9 @@ typedef enum
SF_NONIGHTSSUPER = 1<<15, // Disable super colors for NiGHTS (if you have SF_SUPER) SF_NONIGHTSSUPER = 1<<15, // Disable super colors for NiGHTS (if you have SF_SUPER)
SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super
SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles) SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles)
SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles) SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles)
SF_NOSHIELDABILITY = 1<<19, // Disable shield abilities
// free up to and including 1<<31 // free up to and including 1<<31
} skinflags_t; } skinflags_t;
@ -311,9 +313,43 @@ typedef enum
RW_RAIL = 32 RW_RAIL = 32
} ringweapons_t; } ringweapons_t;
//Bot types
typedef enum
{
BOT_NONE = 0,
BOT_2PAI,
BOT_2PHUMAN,
BOT_MPAI
} bottype_t;
//AI states
typedef enum
{
AI_STANDBY = 0,
AI_FOLLOW,
AI_CATCHUP,
AI_THINKFLY,
AI_FLYSTANDBY,
AI_FLYCARRY,
AI_SPINFOLLOW
} aistatetype_t;
// ======================================================================== // ========================================================================
// PLAYER STRUCTURE // PLAYER STRUCTURE
// ======================================================================== // ========================================================================
//Bot memory struct
typedef struct botmem_s
{
boolean lastForward;
boolean lastBlocked;
boolean blocked;
UINT8 catchup_tics;
UINT8 thinkstate;
} botmem_t;
//Main struct
typedef struct player_s typedef struct player_s
{ {
mobj_t *mo; mobj_t *mo;
@ -523,7 +559,12 @@ typedef struct player_s
boolean spectator; boolean spectator;
boolean outofcoop; boolean outofcoop;
boolean removing;
UINT8 bot; UINT8 bot;
struct player_s *botleader;
UINT16 lastbuttons;
botmem_t botmem;
boolean blocked;
tic_t jointime; // Timer when player joins game to change skin/color tic_t jointime; // Timer when player joins game to change skin/color
tic_t quittime; // Time elapsed since user disconnected, zero if connected tic_t quittime; // Time elapsed since user disconnected, zero if connected

View file

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

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -21,6 +21,8 @@
#pragma interface #pragma interface
#endif #endif
#define MAXPREDICTTICS 12
// Button/action code definitions. // Button/action code definitions.
typedef enum typedef enum
{ {
@ -63,6 +65,7 @@ typedef struct
INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos
INT16 aiming; // vertical aiming, see G_BuildTicCmd INT16 aiming; // vertical aiming, see G_BuildTicCmd
UINT16 buttons; UINT16 buttons;
UINT8 latency; // Netgames: how many tics ago was this ticcmd generated from this player's end?
} ATTRPACK ticcmd_t; } ATTRPACK ticcmd_t;
#if defined(_MSC_VER) #if defined(_MSC_VER)

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -25,10 +25,6 @@
#include "deh_lua.h" #include "deh_lua.h"
#include "deh_tables.h" #include "deh_tables.h"
#ifdef MUSICSLOT_COMPATIBILITY
#include "deh_soc.h" // for get_mus
#endif
// freeslot takes a name (string only!) // freeslot takes a name (string only!)
// and allocates it to the appropriate free slot. // and allocates it to the appropriate free slot.
// Returns the slot number allocated for it or nil if failed. // Returns the slot number allocated for it or nil if failed.
@ -264,6 +260,11 @@ static inline int lib_getenum(lua_State *L)
lua_pushinteger(L, ((lua_Integer)1<<i)); lua_pushinteger(L, ((lua_Integer)1<<i));
return 1; return 1;
} }
if (fastcmp(p, "REVERSESUPER"))
{
lua_pushinteger(L, (lua_Integer)MFE_REVERSESUPER);
return 1;
}
if (mathlib) return luaL_error(L, "mobjeflag '%s' could not be found.\n", word); if (mathlib) return luaL_error(L, "mobjeflag '%s' could not be found.\n", word);
return 0; return 0;
} }
@ -430,29 +431,6 @@ static inline int lib_getenum(lua_State *L)
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word); if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
return 0; return 0;
} }
#ifdef MUSICSLOT_COMPATIBILITY
else if (!mathlib && fastncmp("mus_",word,4)) {
p = word+4;
if ((i = get_mus(p, false)) == 0)
return 0;
lua_pushinteger(L, i);
return 1;
}
else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS!
p = word+4;
if ((i = get_mus(p, false)) == 0)
return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i);
return 1;
}
else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) {
p = word+2;
if ((i = get_mus(p, false)) == 0)
return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i);
return 1;
}
#endif
else if (!mathlib && fastncmp("pw_",word,3)) { else if (!mathlib && fastncmp("pw_",word,3)) {
p = word+3; p = word+3;
for (i = 0; i < NUMPOWERS; i++) for (i = 0; i < NUMPOWERS; i++)

View file

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

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -127,6 +127,33 @@ static float searchfvalue(const char *s)
#endif #endif
// These are for clearing all of various things // These are for clearing all of various things
void clear_emblems(void)
{
INT32 i;
for (i = 0; i < MAXEMBLEMS; ++i)
{
Z_Free(emblemlocations[i].stringVar);
emblemlocations[i].stringVar = NULL;
}
memset(&emblemlocations, 0, sizeof(emblemlocations));
numemblems = 0;
}
void clear_unlockables(void)
{
INT32 i;
for (i = 0; i < MAXUNLOCKABLES; ++i)
{
Z_Free(unlockables[i].stringVar);
unlockables[i].stringVar = NULL;
}
memset(&unlockables, 0, sizeof(unlockables));
}
void clear_conditionsets(void) void clear_conditionsets(void)
{ {
UINT8 i; UINT8 i;
@ -229,7 +256,10 @@ void readPlayer(MYFILE *f, INT32 num)
SLOTFOUND SLOTFOUND
for (i = 0; i < MAXLINELEN-3; i++) // A friendly neighborhood alias for brevity's sake
#define NOTE_SIZE sizeof(description[num].notes)
for (i = 0; i < (INT32)(MAXLINELEN-NOTE_SIZE-3); i++)
{ {
if (s[i] == '=') if (s[i] == '=')
{ {
@ -239,8 +269,9 @@ void readPlayer(MYFILE *f, INT32 num)
} }
if (playertext) if (playertext)
{ {
strcpy(description[num].notes, playertext); strlcpy(description[num].notes, playertext, NOTE_SIZE);
strcat(description[num].notes, myhashfgets(playertext, sizeof (description[num].notes), f)); strlcat(description[num].notes,
myhashfgets(playertext, NOTE_SIZE, f), NOTE_SIZE);
} }
else else
strcpy(description[num].notes, ""); strcpy(description[num].notes, "");
@ -249,7 +280,7 @@ void readPlayer(MYFILE *f, INT32 num)
// It works down here, though. // It works down here, though.
{ {
INT32 numline = 0; INT32 numline = 0;
for (i = 0; (size_t)i < sizeof(description[num].notes)-1; i++) for (i = 0; (size_t)i < NOTE_SIZE-1; i++)
{ {
if (numline < 20 && description[num].notes[i] == '\n') if (numline < 20 && description[num].notes[i] == '\n')
numline++; numline++;
@ -260,6 +291,7 @@ void readPlayer(MYFILE *f, INT32 num)
} }
description[num].notes[strlen(description[num].notes)-1] = '\0'; description[num].notes[strlen(description[num].notes)-1] = '\0';
description[num].notes[i] = '\0'; description[num].notes[i] = '\0';
#undef NOTE_SIZE
continue; continue;
} }
@ -1140,8 +1172,10 @@ void readgametype(MYFILE *f, char *gtname)
} }
if (descr) if (descr)
{ {
strcpy(gtdescription, descr); strlcpy(gtdescription, descr, sizeof (gtdescription));
strcat(gtdescription, myhashfgets(descr, sizeof (gtdescription), f)); strlcat(gtdescription,
myhashfgets(descr, sizeof (gtdescription), f),
sizeof (gtdescription));
} }
else else
strcpy(gtdescription, ""); strcpy(gtdescription, "");
@ -1574,19 +1608,8 @@ void readlevelheader(MYFILE *f, INT32 num)
sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num)); sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num));
} }
} }
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT")) else if (fastcmp(word, "MUSICSLOT"))
{ deh_warning("Level header %d: MusicSlot parameter is deprecated and will be removed.\nUse \"Music\" instead.", num);
i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7);
else
mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
mapheaderinfo[num-1]->musname[6] = 0;
}
#endif
else if (fastcmp(word, "MUSICTRACK")) else if (fastcmp(word, "MUSICTRACK"))
mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1);
else if (fastcmp(word, "MUSICPOS")) else if (fastcmp(word, "MUSICPOS"))
@ -1964,19 +1987,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7); strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
cutscenes[num]->scene[scenenum].musswitch[6] = 0; cutscenes[num]->scene[scenenum].musswitch[6] = 0;
} }
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT"))
{
i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(cutscenes[num]->scene[scenenum].musswitch, compat_special_music_slots[i - 1036], 7);
else
cutscenes[num]->scene[scenenum].musswitch[0] = 0; // becomes empty string
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
}
#endif
else if (fastcmp(word, "MUSICTRACK")) else if (fastcmp(word, "MUSICTRACK"))
{ {
cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
@ -2239,19 +2249,6 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
strncpy(textprompts[num]->page[pagenum].musswitch, word2, 7); strncpy(textprompts[num]->page[pagenum].musswitch, word2, 7);
textprompts[num]->page[pagenum].musswitch[6] = 0; textprompts[num]->page[pagenum].musswitch[6] = 0;
} }
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT"))
{
i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(textprompts[num]->page[pagenum].musswitch, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(textprompts[num]->page[pagenum].musswitch, compat_special_music_slots[i - 1036], 7);
else
textprompts[num]->page[pagenum].musswitch[0] = 0; // becomes empty string
textprompts[num]->page[pagenum].musswitch[6] = 0;
}
#endif
else if (fastcmp(word, "MUSICTRACK")) else if (fastcmp(word, "MUSICTRACK"))
{ {
textprompts[num]->page[pagenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; textprompts[num]->page[pagenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
@ -2577,20 +2574,6 @@ void readmenu(MYFILE *f, INT32 num)
menupres[num].musname[6] = 0; menupres[num].musname[6] = 0;
titlechanged = true; titlechanged = true;
} }
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT"))
{
value = get_mus(word2, true);
if (value && value <= 1035)
snprintf(menupres[num].musname, 7, "%sM", G_BuildMapName(value));
else if (value && value <= 1050)
strncpy(menupres[num].musname, compat_special_music_slots[value - 1036], 7);
else
menupres[num].musname[0] = 0; // becomes empty string
menupres[num].musname[6] = 0;
titlechanged = true;
}
#endif
else if (fastcmp(word, "MUSICTRACK")) else if (fastcmp(word, "MUSICTRACK"))
{ {
menupres[num].mustrack = ((UINT16)value - 1); menupres[num].mustrack = ((UINT16)value - 1);
@ -2839,26 +2822,31 @@ void readsound(MYFILE *f, INT32 num)
if (s[0] == '\n') if (s[0] == '\n')
break; break;
// First remove trailing newline, if there is one
tmp = strchr(s, '\n');
if (tmp)
*tmp = '\0';
tmp = strchr(s, '#'); tmp = strchr(s, '#');
if (tmp) if (tmp)
*tmp = '\0'; *tmp = '\0';
if (s == tmp) if (s == tmp)
continue; // Skip comment lines, but don't break. continue; // Skip comment lines, but don't break.
word = strtok(s, " "); // Set / reset word
if (word) word = s;
strupr(word);
// Get the part before the " = "
tmp = strchr(s, '=');
if (tmp)
*(tmp-1) = '\0';
else else
break; break;
strupr(word);
word2 = strtok(NULL, " "); // Now get the part after
if (word2) word2 = tmp += 2;
value = atoi(word2); value = atoi(word2); // used for numerical settings
else
{
deh_warning("No value for token %s", word);
continue;
}
if (fastcmp(word, "SINGULAR")) if (fastcmp(word, "SINGULAR"))
{ {
@ -3017,7 +3005,12 @@ void reademblemdata(MYFILE *f, INT32 num)
else if (fastcmp(word, "COLOR")) else if (fastcmp(word, "COLOR"))
emblemlocations[num-1].color = get_number(word2); emblemlocations[num-1].color = get_number(word2);
else if (fastcmp(word, "VAR")) else if (fastcmp(word, "VAR"))
{
Z_Free(emblemlocations[num-1].stringVar);
emblemlocations[num-1].stringVar = Z_StrDup(word2);
emblemlocations[num-1].var = get_number(word2); emblemlocations[num-1].var = get_number(word2);
}
else else
deh_warning("Emblem %d: unknown word '%s'", num, word); deh_warning("Emblem %d: unknown word '%s'", num, word);
} }
@ -3219,11 +3212,16 @@ void readunlockable(MYFILE *f, INT32 num)
unlockables[num].type = SECRET_WARP; unlockables[num].type = SECRET_WARP;
else if (fastcmp(word2, "SOUNDTEST")) else if (fastcmp(word2, "SOUNDTEST"))
unlockables[num].type = SECRET_SOUNDTEST; unlockables[num].type = SECRET_SOUNDTEST;
else if (fastcmp(word2, "SKIN"))
unlockables[num].type = SECRET_SKIN;
else else
unlockables[num].type = (INT16)i; unlockables[num].type = (INT16)i;
} }
else if (fastcmp(word, "VAR")) else if (fastcmp(word, "VAR"))
{ {
Z_Free(unlockables[num].stringVar);
unlockables[num].stringVar = Z_StrDup(word2);
// Support using the actual map name, // Support using the actual map name,
// i.e., Level AB, Level FZ, etc. // i.e., Level AB, Level FZ, etc.
@ -4178,46 +4176,6 @@ sfxenum_t get_sfx(const char *word)
return sfx_None; return sfx_None;
} }
#ifdef MUSICSLOT_COMPATIBILITY
UINT16 get_mus(const char *word, UINT8 dehacked_mode)
{ // Returns the value of MUS_ enumerations
UINT16 i;
char lumptmp[4];
if (*word >= '0' && *word <= '9')
return atoi(word);
if (!word[2] && toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
return (UINT16)M_MapNumber(word[0], word[1]);
if (fastncmp("MUS_",word,4))
word += 4; // take off the MUS_
else if (fastncmp("O_",word,2) || fastncmp("D_",word,2))
word += 2; // take off the O_ or D_
strncpy(lumptmp, word, 4);
lumptmp[3] = 0;
if (fasticmp("MAP",lumptmp))
{
word += 3;
if (toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
return (UINT16)M_MapNumber(word[0], word[1]);
else if ((i = atoi(word)))
return i;
word -= 3;
if (dehacked_mode)
deh_warning("Couldn't find music named 'MUS_%s'",word);
return 0;
}
for (i = 0; compat_special_music_slots[i][0]; ++i)
if (fasticmp(word, compat_special_music_slots[i]))
return i + 1036;
if (dehacked_mode)
deh_warning("Couldn't find music named 'MUS_%s'",word);
return 0;
}
#endif
hudnum_t get_huditem(const char *word) hudnum_t get_huditem(const char *word)
{ // Returns the value of HUD_ enumerations { // Returns the value of HUD_ enumerations
hudnum_t i; hudnum_t i;
@ -4448,13 +4406,6 @@ static fixed_t find_const(const char **rword)
free(word); free(word);
return r; return r;
} }
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) {
r = get_mus(word, true);
free(word);
return r;
}
#endif
else if (fastncmp("PW_",word,3)) { else if (fastncmp("PW_",word,3)) {
r = get_power(word); r = get_power(word);
free(word); free(word);

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -43,7 +43,7 @@
#include "info.h" #include "info.h"
#include "dehacked.h" #include "dehacked.h"
#include "doomdef.h" // MUSICSLOT_COMPATIBILITY, HWRENDER #include "doomdef.h" // HWRENDER
// Crazy word-reading stuff // Crazy word-reading stuff
/// \todo Put these in a seperate file or something. /// \todo Put these in a seperate file or something.
@ -52,9 +52,6 @@ statenum_t get_state(const char *word);
spritenum_t get_sprite(const char *word); spritenum_t get_sprite(const char *word);
playersprite_t get_sprite2(const char *word); playersprite_t get_sprite2(const char *word);
sfxenum_t get_sfx(const char *word); sfxenum_t get_sfx(const char *word);
#ifdef MUSICSLOT_COMPATIBILITY
UINT16 get_mus(const char *word, UINT8 dehacked_mode);
#endif
hudnum_t get_huditem(const char *word); hudnum_t get_huditem(const char *word);
menutype_t get_menutype(const char *word); menutype_t get_menutype(const char *word);
//INT16 get_gametype(const char *word); //INT16 get_gametype(const char *word);
@ -84,6 +81,8 @@ void readskincolor(MYFILE *f, INT32 num);
void readthing(MYFILE *f, INT32 num); void readthing(MYFILE *f, INT32 num);
void readfreeslots(MYFILE *f); void readfreeslots(MYFILE *f);
void readPlayer(MYFILE *f, INT32 num); void readPlayer(MYFILE *f, INT32 num);
void clear_emblems(void);
void clear_unlockables(void);
void clear_levels(void); void clear_levels(void);
void clear_conditionsets(void); void clear_conditionsets(void);
#endif #endif

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -22,6 +22,9 @@
#include "v_video.h" // video flags (for lua) #include "v_video.h" // video flags (for lua)
#include "i_sound.h" // musictype_t (for lua) #include "i_sound.h" // musictype_t (for lua)
#include "g_state.h" // gamestate_t (for lua) #include "g_state.h" // gamestate_t (for lua)
#include "g_game.h" // Joystick axes (for lua)
#include "i_joy.h"
#include "g_input.h" // Game controls (for lua)
#include "deh_tables.h" #include "deh_tables.h"
@ -1523,6 +1526,13 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
"S_SPINFIRE5", "S_SPINFIRE5",
"S_SPINFIRE6", "S_SPINFIRE6",
"S_TEAM_SPINFIRE1",
"S_TEAM_SPINFIRE2",
"S_TEAM_SPINFIRE3",
"S_TEAM_SPINFIRE4",
"S_TEAM_SPINFIRE5",
"S_TEAM_SPINFIRE6",
// Spikes // Spikes
"S_SPIKE1", "S_SPIKE1",
"S_SPIKE2", "S_SPIKE2",
@ -3479,9 +3489,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
"S_BLUEBRICKDEBRIS", "S_BLUEBRICKDEBRIS",
"S_YELLOWBRICKDEBRIS", "S_YELLOWBRICKDEBRIS",
#ifdef SEENAMES
"S_NAMECHECK", "S_NAMECHECK",
#endif
}; };
// RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1", // RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1",
@ -4262,9 +4270,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t
"MT_BLUEBRICKDEBRIS", "MT_BLUEBRICKDEBRIS",
"MT_YELLOWBRICKDEBRIS", "MT_YELLOWBRICKDEBRIS",
#ifdef SEENAMES
"MT_NAMECHECK", "MT_NAMECHECK",
#endif
}; };
const char *const MOBJFLAG_LIST[] = { const char *const MOBJFLAG_LIST[] = {
@ -4333,6 +4339,7 @@ const char *const MOBJFLAG2_LIST[] = {
"AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH "AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH
"LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) "LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position)
"SHIELD", // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use) "SHIELD", // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use)
"SPLAT", // Object is a splat
NULL NULL
}; };
@ -4349,6 +4356,8 @@ const char *const MOBJEFLAG_LIST[] = {
"SPRUNG", // Mobj was already sprung this tic "SPRUNG", // Mobj was already sprung this tic
"APPLYPMOMZ", // Platform movement "APPLYPMOMZ", // Platform movement
"TRACERANGLE", // Compute and trigger on mobj angle relative to tracer "TRACERANGLE", // Compute and trigger on mobj angle relative to tracer
"FORCESUPER", // Forces an object to use super sprites with SPR_PLAY.
"FORCENOSUPER", // Forces an object to NOT use super sprites with SPR_PLAY.
NULL NULL
}; };
@ -4796,6 +4805,7 @@ struct int_const_s const INT_CONST[] = {
// fixed_t constants, from m_fixed.h // fixed_t constants, from m_fixed.h
{"FRACUNIT",FRACUNIT}, {"FRACUNIT",FRACUNIT},
{"FU" ,FRACUNIT},
{"FRACBITS",FRACBITS}, {"FRACBITS",FRACBITS},
// doomdef.h constants // doomdef.h constants
@ -4873,6 +4883,36 @@ struct int_const_s const INT_CONST[] = {
{"tr_trans90",tr_trans90}, {"tr_trans90",tr_trans90},
{"NUMTRANSMAPS",NUMTRANSMAPS}, {"NUMTRANSMAPS",NUMTRANSMAPS},
// Alpha styles (blend modes)
{"AST_COPY",AST_COPY},
{"AST_TRANSLUCENT",AST_TRANSLUCENT},
{"AST_ADD",AST_ADD},
{"AST_SUBTRACT",AST_SUBTRACT},
{"AST_REVERSESUBTRACT",AST_REVERSESUBTRACT},
{"AST_MODULATE",AST_MODULATE},
{"AST_OVERLAY",AST_OVERLAY},
// Render flags
{"RF_HORIZONTALFLIP",RF_HORIZONTALFLIP},
{"RF_VERTICALFLIP",RF_VERTICALFLIP},
{"RF_ABSOLUTEOFFSETS",RF_ABSOLUTEOFFSETS},
{"RF_FLIPOFFSETS",RF_FLIPOFFSETS},
{"RF_SPLATMASK",RF_SPLATMASK},
{"RF_SLOPESPLAT",RF_SLOPESPLAT},
{"RF_OBJECTSLOPESPLAT",RF_OBJECTSLOPESPLAT},
{"RF_NOSPLATBILLBOARD",RF_NOSPLATBILLBOARD},
{"RF_NOSPLATROLLANGLE",RF_NOSPLATROLLANGLE},
{"RF_BLENDMASK",RF_BLENDMASK},
{"RF_FULLBRIGHT",RF_FULLBRIGHT},
{"RF_FULLDARK",RF_FULLDARK},
{"RF_NOCOLORMAPS",RF_NOCOLORMAPS},
{"RF_SPRITETYPEMASK",RF_SPRITETYPEMASK},
{"RF_PAPERSPRITE",RF_PAPERSPRITE},
{"RF_FLOORSPRITE",RF_FLOORSPRITE},
{"RF_SHADOWDRAW",RF_SHADOWDRAW},
{"RF_SHADOWEFFECTS",RF_SHADOWEFFECTS},
{"RF_DROPSHADOW",RF_DROPSHADOW},
// Level flags // Level flags
{"LF_SCRIPTISFILE",LF_SCRIPTISFILE}, {"LF_SCRIPTISFILE",LF_SCRIPTISFILE},
{"LF_SPEEDMUSIC",LF_SPEEDMUSIC}, {"LF_SPEEDMUSIC",LF_SPEEDMUSIC},
@ -4989,6 +5029,7 @@ struct int_const_s const INT_CONST[] = {
{"SF_NOSUPERSPRITES",SF_NOSUPERSPRITES}, {"SF_NOSUPERSPRITES",SF_NOSUPERSPRITES},
{"SF_NOSUPERJUMPBOOST",SF_NOSUPERJUMPBOOST}, {"SF_NOSUPERJUMPBOOST",SF_NOSUPERJUMPBOOST},
{"SF_CANBUSTWALLS",SF_CANBUSTWALLS}, {"SF_CANBUSTWALLS",SF_CANBUSTWALLS},
{"SF_NOSHIELDABILITY",SF_NOSHIELDABILITY},
// Dashmode constants // Dashmode constants
{"DASHMODE_THRESHOLD",DASHMODE_THRESHOLD}, {"DASHMODE_THRESHOLD",DASHMODE_THRESHOLD},
@ -5133,6 +5174,12 @@ struct int_const_s const INT_CONST[] = {
{"GF_REDFLAG",GF_REDFLAG}, {"GF_REDFLAG",GF_REDFLAG},
{"GF_BLUEFLAG",GF_BLUEFLAG}, {"GF_BLUEFLAG",GF_BLUEFLAG},
// Bot types
{"BOT_NONE",BOT_NONE},
{"BOT_2PAI",BOT_2PAI},
{"BOT_2PHUMAN",BOT_2PHUMAN},
{"BOT_MPAI",BOT_MPAI},
// Customisable sounds for Skins, from sounds.h // Customisable sounds for Skins, from sounds.h
{"SKSSPIN",SKSSPIN}, {"SKSSPIN",SKSSPIN},
{"SKSPUTPUT",SKSPUTPUT}, {"SKSPUTPUT",SKSPUTPUT},
@ -5421,5 +5468,99 @@ struct int_const_s const INT_CONST[] = {
{"GS_DEDICATEDSERVER",GS_DEDICATEDSERVER}, {"GS_DEDICATEDSERVER",GS_DEDICATEDSERVER},
{"GS_WAITINGPLAYERS",GS_WAITINGPLAYERS}, {"GS_WAITINGPLAYERS",GS_WAITINGPLAYERS},
// Joystick axes
{"JA_NONE",JA_NONE},
{"JA_TURN",JA_TURN},
{"JA_MOVE",JA_MOVE},
{"JA_LOOK",JA_LOOK},
{"JA_STRAFE",JA_STRAFE},
{"JA_DIGITAL",JA_DIGITAL},
{"JA_JUMP",JA_JUMP},
{"JA_SPIN",JA_SPIN},
{"JA_FIRE",JA_FIRE},
{"JA_FIRENORMAL",JA_FIRENORMAL},
{"JOYAXISRANGE",JOYAXISRANGE},
// Game controls
{"GC_NULL",GC_NULL},
{"GC_FORWARD",GC_FORWARD},
{"GC_BACKWARD",GC_BACKWARD},
{"GC_STRAFELEFT",GC_STRAFELEFT},
{"GC_STRAFERIGHT",GC_STRAFERIGHT},
{"GC_TURNLEFT",GC_TURNLEFT},
{"GC_TURNRIGHT",GC_TURNRIGHT},
{"GC_WEAPONNEXT",GC_WEAPONNEXT},
{"GC_WEAPONPREV",GC_WEAPONPREV},
{"GC_WEPSLOT1",GC_WEPSLOT1},
{"GC_WEPSLOT2",GC_WEPSLOT2},
{"GC_WEPSLOT3",GC_WEPSLOT3},
{"GC_WEPSLOT4",GC_WEPSLOT4},
{"GC_WEPSLOT5",GC_WEPSLOT5},
{"GC_WEPSLOT6",GC_WEPSLOT6},
{"GC_WEPSLOT7",GC_WEPSLOT7},
{"GC_WEPSLOT8",GC_WEPSLOT8},
{"GC_WEPSLOT9",GC_WEPSLOT9},
{"GC_WEPSLOT10",GC_WEPSLOT10},
{"GC_FIRE",GC_FIRE},
{"GC_FIRENORMAL",GC_FIRENORMAL},
{"GC_TOSSFLAG",GC_TOSSFLAG},
{"GC_SPIN",GC_SPIN},
{"GC_CAMTOGGLE",GC_CAMTOGGLE},
{"GC_CAMRESET",GC_CAMRESET},
{"GC_LOOKUP",GC_LOOKUP},
{"GC_LOOKDOWN",GC_LOOKDOWN},
{"GC_CENTERVIEW",GC_CENTERVIEW},
{"GC_MOUSEAIMING",GC_MOUSEAIMING},
{"GC_TALKKEY",GC_TALKKEY},
{"GC_TEAMKEY",GC_TEAMKEY},
{"GC_SCORES",GC_SCORES},
{"GC_JUMP",GC_JUMP},
{"GC_CONSOLE",GC_CONSOLE},
{"GC_PAUSE",GC_PAUSE},
{"GC_SYSTEMMENU",GC_SYSTEMMENU},
{"GC_SCREENSHOT",GC_SCREENSHOT},
{"GC_RECORDGIF",GC_RECORDGIF},
{"GC_VIEWPOINT",GC_VIEWPOINT},
{"GC_CUSTOM1",GC_CUSTOM1},
{"GC_CUSTOM2",GC_CUSTOM2},
{"GC_CUSTOM3",GC_CUSTOM3},
{"NUM_GAMECONTROLS",NUM_GAMECONTROLS},
// Mouse buttons
{"MB_BUTTON1",MB_BUTTON1},
{"MB_BUTTON2",MB_BUTTON2},
{"MB_BUTTON3",MB_BUTTON3},
{"MB_BUTTON4",MB_BUTTON4},
{"MB_BUTTON5",MB_BUTTON5},
{"MB_BUTTON6",MB_BUTTON6},
{"MB_BUTTON7",MB_BUTTON7},
{"MB_BUTTON8",MB_BUTTON8},
{"MB_SCROLLUP",MB_SCROLLUP},
{"MB_SCROLLDOWN",MB_SCROLLDOWN},
{NULL,0} {NULL,0}
}; };
// For this to work compile-time without being in this file,
// this function would need to check sizes at runtime, without sizeof
void DEH_TableCheck(void)
{
#if defined(_DEBUG) || defined(PARANOIA)
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*);
const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*);
const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*);
if (dehstates != S_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates));
if (dehmobjs != MT_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked mobjtype list, you dolt!\n(%d mobj types defined, versus %s in the Dehacked list)\n", MT_FIRSTFREESLOT, sizeu1(dehmobjs));
if (dehpowers != NUMPOWERS)
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
if (dehcolors != SKINCOLOR_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors));
#endif
}

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -72,4 +72,7 @@ extern const char *const MENUTYPES_LIST[];
extern struct int_const_s const INT_CONST[]; extern struct int_const_s const INT_CONST[];
// Moved to this file because it can't work compile-time otherwise
void DEH_TableCheck(void);
#endif #endif

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -59,6 +59,12 @@ ATTRINLINE static FUNCINLINE char myfget_color(MYFILE *f)
if (c >= '0' && c <= '9') if (c >= '0' && c <= '9')
return 0x80+(c-'0'); return 0x80+(c-'0');
c = tolower(c);
if (c >= 'a' && c <= 'f')
return 0x80+10+(c-'a');
return 0x80; // Unhandled -- default to no color return 0x80; // Unhandled -- default to no color
} }
@ -182,26 +188,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
dbg_line = -1; // start at -1 so the first line is 0. dbg_line = -1; // start at -1 so the first line is 0.
while (!myfeof(f)) while (!myfeof(f))
{ {
char origpos[128];
INT32 size = 0;
char *traverse;
myfgets(s, MAXLINELEN, f); myfgets(s, MAXLINELEN, f);
memcpy(textline, s, MAXLINELEN); memcpy(textline, s, MAXLINELEN);
if (s[0] == '\n' || s[0] == '#') if (s[0] == '\n' || s[0] == '#')
continue; continue;
traverse = s;
while (traverse[0] != '\n')
{
traverse++;
size++;
}
strncpy(origpos, s, size);
origpos[size] = '\0';
if (NULL != (word = strtok(s, " "))) { if (NULL != (word = strtok(s, " "))) {
strupr(word); strupr(word);
if (word[strlen(word)-1] == '\n') if (word[strlen(word)-1] == '\n')
@ -556,13 +547,10 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
} }
if (clearall || fastcmp(word2, "UNLOCKABLES")) if (clearall || fastcmp(word2, "UNLOCKABLES"))
memset(&unlockables, 0, sizeof(unlockables)); clear_unlockables();
if (clearall || fastcmp(word2, "EMBLEMS")) if (clearall || fastcmp(word2, "EMBLEMS"))
{ clear_emblems();
memset(&emblemlocations, 0, sizeof(emblemlocations));
numemblems = 0;
}
if (clearall || fastcmp(word2, "EXTRAEMBLEMS")) if (clearall || fastcmp(word2, "EXTRAEMBLEMS"))
{ {
@ -639,25 +627,3 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
{ {
DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum), false); DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum), false);
} }
void DEH_Check(void)
{
#if defined(_DEBUG) || defined(PARANOIA)
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*);
const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*);
const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*);
if (dehstates != S_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates));
if (dehmobjs != MT_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked mobjtype list, you dolt!\n(%d mobj types defined, versus %s in the Dehacked list)\n", MT_FIRSTFREESLOT, sizeu1(dehmobjs));
if (dehpowers != NUMPOWERS)
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
if (dehcolors != SKINCOLOR_FIRSTFREESLOT)
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors));
#endif
}

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior. // Copyright (C) 1999-2021 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -30,8 +30,6 @@ typedef enum
void DEH_LoadDehackedLump(lumpnum_t lumpnum); void DEH_LoadDehackedLump(lumpnum_t lumpnum);
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile); void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile);
void DEH_Check(void);
fixed_t get_number(const char *word); fixed_t get_number(const char *word);
FUNCPRINTF void deh_warning(const char *first, ...); FUNCPRINTF void deh_warning(const char *first, ...);
void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext); void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext);

View file

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

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